Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

unix code not working on linux


  • Please log in to reply
17 replies to this topic

#1 genius_mind

genius_mind

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:06:32 AM

Posted 07 August 2017 - 03:01 PM

I have below code 

if [[ ${NUM_CHG_PARTS} -eq 0 ]]
then
COUNT=1
else
((COUNT=NUM_CHG_PARTS))
fi
+ [[ 48 -eq 0 ]]
+ (( COUNT=NUM_CHG_PARTS ))


I=1
+ I=1
FILE_COUNT=0
+ FILE_COUNT=0
while [[ ${I} -le ${COUNT} ]]
do
if [[ ${I} -lt 10 ]]
then
export PARTITION_ID="P0"${I}
else
export PARTITION_ID="P"${I}
fi

CD01_EXTRACT_FILE_TEMP='ar.ARCD-01.'$REPORT_DATE'.extract.'$CYCLE_NO'_'$CYCLE_MM'_'$CYCLE_YYYY.$PARTITION_ID
if (test -r $CD01_EXTRACT_FILE_TEMP)
then
cat $CD01_EXTRACT_FILE_TEMP >> $CD01_EXTRACT_FILE
((FILE_COUNT=FILE_COUNT+1))
fi
((I=I+1))
done

and in the end its comparing as below

if [[ (${FILE_COUNT} -eq 0) || (${FILE_COUNT} -lt ${NUM_CHG_PARTS}) ]]
then
echo "Not all the Extract files were created"
TlgFilePlacer $IR01_EXTRACT_FILE FAILURE
ExitProcess 1
fi


Its not increasing the file_count

as this code is working on unix something went wrong on linux
If someone can help me with this.



BC AdBot (Login to Remove)

 


#2 Mike_Walsh

Mike_Walsh

    Bleepin' 'Puppy' nut..!!


  • Members
  • 1,415 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:King's Lynn, UK
  • Local time:11:32 AM

Posted 07 August 2017 - 03:37 PM

Quite simply, Linux is not Unix. Linux is 'Unix-like'.....but it does not work exactly the same. I believe I'm right in saying that if you want a more genuinely Unix-approximate experience, then you would be better off with the BSD distributions. FreeBSD, GhostBSD, NetBSD, DragonflyBSD, etc.....the list goes on & on.

 

There's a list here of all the BSD and BSD-based distros that are available. There's quite a lot of them.

 

Beyond that, it's out of my sphere of understanding. I don't know the first thing about Unix proper. I'll admit, it does look quite similar in places to various Linux scripts (notably written in Bash), which I've worked on in the past. In no sense of the word could I be referred to as a 'script-kiddie', I'm afraid; I avoid having to work with them as much as possible!

 

However, we do have a few BSD users. They may be able to offer better assistance. I've PM'd one of them for you, to see if he may be able to help out.

 

 

Mike.  :wink:


Edited by Mike_Walsh, 07 August 2017 - 03:57 PM.

Distros:- Multiple 'Puppies'..... and Anti-X 16.1

My Puppy BLOG ~~~  My Puppy PACKAGES

Compaq Presario SR1916UK; Athlon64 X2 3800+, 3 GB RAM, WD 500GB Caviar 'Blue', 32GB Kingspec PATA SSD, 3 TB Seagate 'Expansion' external HDD, ATI Radeon Xpress 200 graphics, Dell 15.1" pNp monitor (1024 x 768), TP-Link PCI-e USB 3.0 card, Logitech c920 HD Pro webcam, self-powered 7-port USB 2.0 hub

Dell Inspiron 1100; 2.6 GHz 400FSB P4, 1.5 GB RAM, 64GB KingSpec IDE SSD, Intel 'Extreme' graphics, 1 TB Seagate 'Expansion' external HDD, M$ HD-3000 'Lifecam'.

 

KXhaWqy.gifFQ8nrJ3.gif

 

 


#3 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:06:32 AM

Posted 07 August 2017 - 04:05 PM

OP, this is shell code, yes?  What's the sehbang line at the top of the file?  #/bin/bash, #/bin/sh, ????

The line that's incrementing FILE_COUNT, is inside the if (test -r   are you sure that it's getting hit?  Did you try a simple echo of the variable?  If you don't hit that echo then your test is not returning true.    Some bash stuff is different than sh stuff and most Linux systems have /bin/sh symlinked to /bin/bash.

 

I'd start by adding an echo of CD01_EXTRACT_FILE_TEMP right above the if statement, then do something like ls -l of it to see if your test would pass.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#4 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:06:32 AM

Posted 07 August 2017 - 04:08 PM

As Mike as stated, not all parts of unix coding are going to work in linux. Its also going to depend on the environment you are using (some do things slightly different). I.E bash, csh, tcsh,... etc etc

 

See here how to use a iterator in bash.


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#5 genius_mind

genius_mind
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:06:32 AM

Posted 07 August 2017 - 04:21 PM

Hi ,

 

My script is starting with 

 
#!/bin/sh
 
I tried printing file_count but its just getting value 1 and not incrementing  it. and dats why in the end when its checking file_count with no_of_parts its failing 
I am not understanding why its not incrementing.
Did i use wrong syntax somewhere??


#6 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:06:32 AM

Posted 07 August 2017 - 04:25 PM

Can you post just the code of your iterator?


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#7 genius_mind

genius_mind
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:06:32 AM

Posted 07 August 2017 - 04:34 PM

if [[ ${NUM_CHG_PARTS} -eq 0 ]]
then
  COUNT=1
else
  ((COUNT=NUM_CHG_PARTS))
fi
+ [[ 48 -eq 0 ]]
+ (( COUNT=NUM_CHG_PARTS ))
 
 
I=1
+ I=1
FILE_COUNT=0
+ FILE_COUNT=0
while [[ ${I} -le ${COUNT} ]]
do
  if [[ ${I} -lt 10 ]]
  then
    export PARTITION_ID="P0"${I}
  else
    export PARTITION_ID="P"${I}
  fi
 
  CD01_EXTRACT_FILE_TEMP='ar.ARCD-01.'$REPORT_DATE'.extract.'$CYCLE_NO'_'$CYCLE_MM'_'$CYCLE_YYYY.$PARTITION_ID
  if (test -r $CD01_EXTRACT_FILE_TEMP)
  then
     cat $CD01_EXTRACT_FILE_TEMP >> $CD01_EXTRACT_FILE
     ((${FILE_COUNT}=${FILE_COUNT}+1))
     echo $FILE_COUNT
  fi
  echo $FILE_COUNT
  ((I=I+1))
done
+ [[ 1 -le 48 ]]
+ [[ 1 -lt 10 ]]
+ export PARTITION_ID=P01
+ PARTITION_ID=P01
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P01
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P01
+ cat ar.ARCD-01.20170731.extract.01_6_2017.P01
+ (( 0=0+1 ))
/dbl_sh_unc/fs_users/oprtub01/users/shweta_backup/ARAMDPCYCREP/arcd01: line 640: ((: 0=0+1: attempted assignment to non-variable (error token is "=0+1")
+ echo 0
0
+ echo 0
0
+ (( I=I+1 ))
+ [[ 2 -le 48 ]]
+ [[ 2 -lt 10 ]]
+ export PARTITION_ID=P02
+ PARTITION_ID=P02
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P02
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P02
+ echo 0
0
+ (( I=I+1 ))
+ [[ 3 -le 48 ]]
+ [[ 3 -lt 10 ]]
+ export PARTITION_ID=P03
+ PARTITION_ID=P03
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P03
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P03
+ echo 0
0
+ (( I=I+1 ))
+ [[ 4 -le 48 ]]
+ [[ 4 -lt 10 ]]
+ export PARTITION_ID=P04
+ PARTITION_ID=P04
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P04
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P04
+ echo 0
0
+ (( I=I+1 ))
+ [[ 5 -le 48 ]]
+ [[ 5 -lt 10 ]]
+ export PARTITION_ID=P05
+ PARTITION_ID=P05
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P05
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P05
+ echo 0
0
+ (( I=I+1 ))
+ [[ 6 -le 48 ]]
+ [[ 6 -lt 10 ]]
+ export PARTITION_ID=P06
+ PARTITION_ID=P06
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P06
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P06
+ echo 0
0
+ (( I=I+1 ))
+ [[ 7 -le 48 ]]
+ [[ 7 -lt 10 ]]
+ export PARTITION_ID=P07
+ PARTITION_ID=P07
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P07
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P07
+ echo 0
0
+ (( I=I+1 ))
+ [[ 8 -le 48 ]]
+ [[ 8 -lt 10 ]]
+ export PARTITION_ID=P08
+ PARTITION_ID=P08
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P08
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P08
+ echo 0
0
+ (( I=I+1 ))
+ [[ 9 -le 48 ]]
+ [[ 9 -lt 10 ]]
+ export PARTITION_ID=P09
+ PARTITION_ID=P09
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P09
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P09
+ echo 0
0
+ (( I=I+1 ))
+ [[ 10 -le 48 ]]
+ [[ 10 -lt 10 ]]
+ export PARTITION_ID=P10
+ PARTITION_ID=P10
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P10
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P10
+ echo 0
0
+ (( I=I+1 ))
+ [[ 11 -le 48 ]]
+ [[ 11 -lt 10 ]]
+ export PARTITION_ID=P11
+ PARTITION_ID=P11
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P11
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P11
+ echo 0
0
+ (( I=I+1 ))
+ [[ 12 -le 48 ]]
+ [[ 12 -lt 10 ]]
+ export PARTITION_ID=P12
+ PARTITION_ID=P12
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P12
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P12
+ echo 0
0
+ (( I=I+1 ))
+ [[ 13 -le 48 ]]
+ [[ 13 -lt 10 ]]
+ export PARTITION_ID=P13
+ PARTITION_ID=P13
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P13
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P13
+ echo 0
0
+ (( I=I+1 ))
+ [[ 14 -le 48 ]]
+ [[ 14 -lt 10 ]]
+ export PARTITION_ID=P14
+ PARTITION_ID=P14
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P14
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P14
+ echo 0
0
+ (( I=I+1 ))
+ [[ 15 -le 48 ]]
+ [[ 15 -lt 10 ]]
+ export PARTITION_ID=P15
+ PARTITION_ID=P15
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P15
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P15
+ echo 0
0
+ (( I=I+1 ))
+ [[ 16 -le 48 ]]
+ [[ 16 -lt 10 ]]
+ export PARTITION_ID=P16
+ PARTITION_ID=P16
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P16
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P16
+ echo 0
0
+ (( I=I+1 ))
+ [[ 17 -le 48 ]]
+ [[ 17 -lt 10 ]]
+ export PARTITION_ID=P17
+ PARTITION_ID=P17
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P17
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P17
+ echo 0
0
+ (( I=I+1 ))
+ [[ 18 -le 48 ]]
+ [[ 18 -lt 10 ]]
+ export PARTITION_ID=P18
+ PARTITION_ID=P18
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P18
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P18
+ echo 0
0
+ (( I=I+1 ))
+ [[ 19 -le 48 ]]
+ [[ 19 -lt 10 ]]
+ export PARTITION_ID=P19
+ PARTITION_ID=P19
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P19
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P19
+ echo 0
0
+ (( I=I+1 ))
+ [[ 20 -le 48 ]]
+ [[ 20 -lt 10 ]]
+ export PARTITION_ID=P20
+ PARTITION_ID=P20
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P20
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P20
+ echo 0
0
+ (( I=I+1 ))
+ [[ 21 -le 48 ]]
+ [[ 21 -lt 10 ]]
+ export PARTITION_ID=P21
+ PARTITION_ID=P21
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P21
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P21
+ echo 0
0
+ (( I=I+1 ))
+ [[ 22 -le 48 ]]
+ [[ 22 -lt 10 ]]
+ export PARTITION_ID=P22
+ PARTITION_ID=P22
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P22
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P22
+ echo 0
0
+ (( I=I+1 ))
+ [[ 23 -le 48 ]]
+ [[ 23 -lt 10 ]]
+ export PARTITION_ID=P23
+ PARTITION_ID=P23
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P23
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P23
+ echo 0
0
+ (( I=I+1 ))
+ [[ 24 -le 48 ]]
+ [[ 24 -lt 10 ]]
+ export PARTITION_ID=P24
+ PARTITION_ID=P24
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P24
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P24
+ echo 0
0
+ (( I=I+1 ))
+ [[ 25 -le 48 ]]
+ [[ 25 -lt 10 ]]
+ export PARTITION_ID=P25
+ PARTITION_ID=P25
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P25
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P25
+ echo 0
0
+ (( I=I+1 ))
+ [[ 26 -le 48 ]]
+ [[ 26 -lt 10 ]]
+ export PARTITION_ID=P26
+ PARTITION_ID=P26
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P26
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P26
+ echo 0
0
+ (( I=I+1 ))
+ [[ 27 -le 48 ]]
+ [[ 27 -lt 10 ]]
+ export PARTITION_ID=P27
+ PARTITION_ID=P27
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P27
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P27
+ echo 0
0
+ (( I=I+1 ))
+ [[ 28 -le 48 ]]
+ [[ 28 -lt 10 ]]
+ export PARTITION_ID=P28
+ PARTITION_ID=P28
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P28
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P28
+ echo 0
0
+ (( I=I+1 ))
+ [[ 29 -le 48 ]]
+ [[ 29 -lt 10 ]]
+ export PARTITION_ID=P29
+ PARTITION_ID=P29
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P29
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P29
+ echo 0
0
+ (( I=I+1 ))
+ [[ 30 -le 48 ]]
+ [[ 30 -lt 10 ]]
+ export PARTITION_ID=P30
+ PARTITION_ID=P30
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P30
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P30
+ echo 0
0
+ (( I=I+1 ))
+ [[ 31 -le 48 ]]
+ [[ 31 -lt 10 ]]
+ export PARTITION_ID=P31
+ PARTITION_ID=P31
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P31
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P31
+ echo 0
0
+ (( I=I+1 ))
+ [[ 32 -le 48 ]]
+ [[ 32 -lt 10 ]]
+ export PARTITION_ID=P32
+ PARTITION_ID=P32
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P32
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P32
+ echo 0
0
+ (( I=I+1 ))
+ [[ 33 -le 48 ]]
+ [[ 33 -lt 10 ]]
+ export PARTITION_ID=P33
+ PARTITION_ID=P33
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P33
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P33
+ echo 0
0
+ (( I=I+1 ))
+ [[ 34 -le 48 ]]
+ [[ 34 -lt 10 ]]
+ export PARTITION_ID=P34
+ PARTITION_ID=P34
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P34
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P34
+ echo 0
0
+ (( I=I+1 ))
+ [[ 35 -le 48 ]]
+ [[ 35 -lt 10 ]]
+ export PARTITION_ID=P35
+ PARTITION_ID=P35
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P35
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P35
+ echo 0
0
+ (( I=I+1 ))
+ [[ 36 -le 48 ]]
+ [[ 36 -lt 10 ]]
+ export PARTITION_ID=P36
+ PARTITION_ID=P36
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P36
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P36
+ echo 0
0
+ (( I=I+1 ))
+ [[ 37 -le 48 ]]
+ [[ 37 -lt 10 ]]
+ export PARTITION_ID=P37
+ PARTITION_ID=P37
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P37
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P37
+ echo 0
0
+ (( I=I+1 ))
+ [[ 38 -le 48 ]]
+ [[ 38 -lt 10 ]]
+ export PARTITION_ID=P38
+ PARTITION_ID=P38
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P38
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P38
+ echo 0
0
+ (( I=I+1 ))
+ [[ 39 -le 48 ]]
+ [[ 39 -lt 10 ]]
+ export PARTITION_ID=P39
+ PARTITION_ID=P39
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P39
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P39
+ echo 0
0
+ (( I=I+1 ))
+ [[ 40 -le 48 ]]
+ [[ 40 -lt 10 ]]
+ export PARTITION_ID=P40
+ PARTITION_ID=P40
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P40
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P40
+ echo 0
0
+ (( I=I+1 ))
+ [[ 41 -le 48 ]]
+ [[ 41 -lt 10 ]]
+ export PARTITION_ID=P41
+ PARTITION_ID=P41
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P41
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P41
+ echo 0
0
+ (( I=I+1 ))
+ [[ 42 -le 48 ]]
+ [[ 42 -lt 10 ]]
+ export PARTITION_ID=P42
+ PARTITION_ID=P42
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P42
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P42
+ echo 0
0
+ (( I=I+1 ))
+ [[ 43 -le 48 ]]
+ [[ 43 -lt 10 ]]
+ export PARTITION_ID=P43
+ PARTITION_ID=P43
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P43
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P43
+ echo 0
0
+ (( I=I+1 ))
+ [[ 44 -le 48 ]]
+ [[ 44 -lt 10 ]]
+ export PARTITION_ID=P44
+ PARTITION_ID=P44
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P44
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P44
+ echo 0
0
+ (( I=I+1 ))
+ [[ 45 -le 48 ]]
+ [[ 45 -lt 10 ]]
+ export PARTITION_ID=P45
+ PARTITION_ID=P45
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P45
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P45
+ echo 0
0
+ (( I=I+1 ))
+ [[ 46 -le 48 ]]
+ [[ 46 -lt 10 ]]
+ export PARTITION_ID=P46
+ PARTITION_ID=P46
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P46
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P46
+ echo 0
0
+ (( I=I+1 ))
+ [[ 47 -le 48 ]]
+ [[ 47 -lt 10 ]]
+ export PARTITION_ID=P47
+ PARTITION_ID=P47
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P47
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P47
+ echo 0
0
+ (( I=I+1 ))
+ [[ 48 -le 48 ]]
+ [[ 48 -lt 10 ]]
+ export PARTITION_ID=P48
+ PARTITION_ID=P48
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P48
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P48
+ echo 0
0
+ (( I=I+1 ))
+ [[ 49 -le 48 ]]
 
if [[ (${FILE_COUNT} -eq 0) || (${FILE_COUNT} -lt ${NUM_CHG_PARTS}) ]]
then
  echo "Not all the Extract files were created"
  TlgFilePlacer $IR01_EXTRACT_FILE FAILURE
  ExitProcess 1
fi
+ [[ 0 -eq 0 ]]
+ echo 'Not all the Extract files were created'
Not all the Extract files were created
 
 
Thanks a lot for ur help


#8 genius_mind

genius_mind
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:06:32 AM

Posted 07 August 2017 - 04:38 PM

Please ignore previous run

as i tried few things in that

 

below is the failure code

 

 

if [[ ${NUM_CHG_PARTS} -eq 0 ]]
then
  COUNT=1
else
  ((COUNT=NUM_CHG_PARTS))
fi
+ [[ 48 -eq 0 ]]
+ (( COUNT=NUM_CHG_PARTS ))
 
 
I=1
+ I=1
FILE_COUNT=0
+ FILE_COUNT=0
while [ ${I} -le ${COUNT} ]
do
  if [[ ${I} -lt 10 ]]
  then
    export PARTITION_ID="P0"${I}
  else
    export PARTITION_ID="P"${I}
  fi
 
  CD01_EXTRACT_FILE_TEMP='ar.ARCD-01.'$REPORT_DATE'.extract.'$CYCLE_NO'_'$CYCLE_MM'_'$CYCLE_YYYY.$PARTITION_ID
  if (test -r $CD01_EXTRACT_FILE_TEMP)
  then
     cat $CD01_EXTRACT_FILE_TEMP >> $CD01_EXTRACT_FILE
     ((FILE_COUNT=FILE_COUNT+1))
  fi
  ((I=I+1))
done
+ '[' 1 -le 48 ']'
+ [[ 1 -lt 10 ]]
+ export PARTITION_ID=P01
+ PARTITION_ID=P01
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P01
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P01
+ cat ar.ARCD-01.20170731.extract.01_6_2017.P01
+ (( FILE_COUNT=FILE_COUNT+1 ))
+ (( I=I+1 ))
+ '[' 2 -le 48 ']'
+ [[ 2 -lt 10 ]]
+ export PARTITION_ID=P02
+ PARTITION_ID=P02
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P02
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P02
+ (( I=I+1 ))
+ '[' 3 -le 48 ']'
+ [[ 3 -lt 10 ]]
+ export PARTITION_ID=P03
+ PARTITION_ID=P03
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P03
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P03
+ (( I=I+1 ))
+ '[' 4 -le 48 ']'
+ [[ 4 -lt 10 ]]
+ export PARTITION_ID=P04
+ PARTITION_ID=P04
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P04
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P04
+ (( I=I+1 ))
+ '[' 5 -le 48 ']'
+ [[ 5 -lt 10 ]]
+ export PARTITION_ID=P05
+ PARTITION_ID=P05
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P05
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P05
+ (( I=I+1 ))
+ '[' 6 -le 48 ']'
+ [[ 6 -lt 10 ]]
+ export PARTITION_ID=P06
+ PARTITION_ID=P06
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P06
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P06
+ (( I=I+1 ))
+ '[' 7 -le 48 ']'
+ [[ 7 -lt 10 ]]
+ export PARTITION_ID=P07
+ PARTITION_ID=P07
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P07
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P07
+ (( I=I+1 ))
+ '[' 8 -le 48 ']'
+ [[ 8 -lt 10 ]]
+ export PARTITION_ID=P08
+ PARTITION_ID=P08
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P08
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P08
+ (( I=I+1 ))
+ '[' 9 -le 48 ']'
+ [[ 9 -lt 10 ]]
+ export PARTITION_ID=P09
+ PARTITION_ID=P09
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P09
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P09
+ (( I=I+1 ))
+ '[' 10 -le 48 ']'
+ [[ 10 -lt 10 ]]
+ export PARTITION_ID=P10
+ PARTITION_ID=P10
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P10
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P10
+ (( I=I+1 ))
+ '[' 11 -le 48 ']'
+ [[ 11 -lt 10 ]]
+ export PARTITION_ID=P11
+ PARTITION_ID=P11
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P11
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P11
+ (( I=I+1 ))
+ '[' 12 -le 48 ']'
+ [[ 12 -lt 10 ]]
+ export PARTITION_ID=P12
+ PARTITION_ID=P12
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P12
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P12
+ (( I=I+1 ))
+ '[' 13 -le 48 ']'
+ [[ 13 -lt 10 ]]
+ export PARTITION_ID=P13
+ PARTITION_ID=P13
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P13
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P13
+ (( I=I+1 ))
+ '[' 14 -le 48 ']'
+ [[ 14 -lt 10 ]]
+ export PARTITION_ID=P14
+ PARTITION_ID=P14
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P14
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P14
+ (( I=I+1 ))
+ '[' 15 -le 48 ']'
+ [[ 15 -lt 10 ]]
+ export PARTITION_ID=P15
+ PARTITION_ID=P15
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P15
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P15
+ (( I=I+1 ))
+ '[' 16 -le 48 ']'
+ [[ 16 -lt 10 ]]
+ export PARTITION_ID=P16
+ PARTITION_ID=P16
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P16
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P16
+ (( I=I+1 ))
+ '[' 17 -le 48 ']'
+ [[ 17 -lt 10 ]]
+ export PARTITION_ID=P17
+ PARTITION_ID=P17
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P17
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P17
+ (( I=I+1 ))
+ '[' 18 -le 48 ']'
+ [[ 18 -lt 10 ]]
+ export PARTITION_ID=P18
+ PARTITION_ID=P18
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P18
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P18
+ (( I=I+1 ))
+ '[' 19 -le 48 ']'
+ [[ 19 -lt 10 ]]
+ export PARTITION_ID=P19
+ PARTITION_ID=P19
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P19
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P19
+ (( I=I+1 ))
+ '[' 20 -le 48 ']'
+ [[ 20 -lt 10 ]]
+ export PARTITION_ID=P20
+ PARTITION_ID=P20
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P20
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P20
+ (( I=I+1 ))
+ '[' 21 -le 48 ']'
+ [[ 21 -lt 10 ]]
+ export PARTITION_ID=P21
+ PARTITION_ID=P21
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P21
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P21
+ (( I=I+1 ))
+ '[' 22 -le 48 ']'
+ [[ 22 -lt 10 ]]
+ export PARTITION_ID=P22
+ PARTITION_ID=P22
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P22
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P22
+ (( I=I+1 ))
+ '[' 23 -le 48 ']'
+ [[ 23 -lt 10 ]]
+ export PARTITION_ID=P23
+ PARTITION_ID=P23
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P23
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P23
+ (( I=I+1 ))
+ '[' 24 -le 48 ']'
+ [[ 24 -lt 10 ]]
+ export PARTITION_ID=P24
+ PARTITION_ID=P24
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P24
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P24
+ (( I=I+1 ))
+ '[' 25 -le 48 ']'
+ [[ 25 -lt 10 ]]
+ export PARTITION_ID=P25
+ PARTITION_ID=P25
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P25
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P25
+ (( I=I+1 ))
+ '[' 26 -le 48 ']'
+ [[ 26 -lt 10 ]]
+ export PARTITION_ID=P26
+ PARTITION_ID=P26
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P26
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P26
+ (( I=I+1 ))
+ '[' 27 -le 48 ']'
+ [[ 27 -lt 10 ]]
+ export PARTITION_ID=P27
+ PARTITION_ID=P27
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P27
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P27
+ (( I=I+1 ))
+ '[' 28 -le 48 ']'
+ [[ 28 -lt 10 ]]
+ export PARTITION_ID=P28
+ PARTITION_ID=P28
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P28
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P28
+ (( I=I+1 ))
+ '[' 29 -le 48 ']'
+ [[ 29 -lt 10 ]]
+ export PARTITION_ID=P29
+ PARTITION_ID=P29
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P29
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P29
+ (( I=I+1 ))
+ '[' 30 -le 48 ']'
+ [[ 30 -lt 10 ]]
+ export PARTITION_ID=P30
+ PARTITION_ID=P30
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P30
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P30
+ (( I=I+1 ))
+ '[' 31 -le 48 ']'
+ [[ 31 -lt 10 ]]
+ export PARTITION_ID=P31
+ PARTITION_ID=P31
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P31
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P31
+ (( I=I+1 ))
+ '[' 32 -le 48 ']'
+ [[ 32 -lt 10 ]]
+ export PARTITION_ID=P32
+ PARTITION_ID=P32
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P32
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P32
+ (( I=I+1 ))
+ '[' 33 -le 48 ']'
+ [[ 33 -lt 10 ]]
+ export PARTITION_ID=P33
+ PARTITION_ID=P33
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P33
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P33
+ (( I=I+1 ))
+ '[' 34 -le 48 ']'
+ [[ 34 -lt 10 ]]
+ export PARTITION_ID=P34
+ PARTITION_ID=P34
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P34
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P34
+ (( I=I+1 ))
+ '[' 35 -le 48 ']'
+ [[ 35 -lt 10 ]]
+ export PARTITION_ID=P35
+ PARTITION_ID=P35
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P35
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P35
+ (( I=I+1 ))
+ '[' 36 -le 48 ']'
+ [[ 36 -lt 10 ]]
+ export PARTITION_ID=P36
+ PARTITION_ID=P36
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P36
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P36
+ (( I=I+1 ))
+ '[' 37 -le 48 ']'
+ [[ 37 -lt 10 ]]
+ export PARTITION_ID=P37
+ PARTITION_ID=P37
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P37
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P37
+ (( I=I+1 ))
+ '[' 38 -le 48 ']'
+ [[ 38 -lt 10 ]]
+ export PARTITION_ID=P38
+ PARTITION_ID=P38
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P38
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P38
+ (( I=I+1 ))
+ '[' 39 -le 48 ']'
+ [[ 39 -lt 10 ]]
+ export PARTITION_ID=P39
+ PARTITION_ID=P39
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P39
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P39
+ (( I=I+1 ))
+ '[' 40 -le 48 ']'
+ [[ 40 -lt 10 ]]
+ export PARTITION_ID=P40
+ PARTITION_ID=P40
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P40
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P40
+ (( I=I+1 ))
+ '[' 41 -le 48 ']'
+ [[ 41 -lt 10 ]]
+ export PARTITION_ID=P41
+ PARTITION_ID=P41
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P41
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P41
+ (( I=I+1 ))
+ '[' 42 -le 48 ']'
+ [[ 42 -lt 10 ]]
+ export PARTITION_ID=P42
+ PARTITION_ID=P42
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P42
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P42
+ (( I=I+1 ))
+ '[' 43 -le 48 ']'
+ [[ 43 -lt 10 ]]
+ export PARTITION_ID=P43
+ PARTITION_ID=P43
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P43
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P43
+ (( I=I+1 ))
+ '[' 44 -le 48 ']'
+ [[ 44 -lt 10 ]]
+ export PARTITION_ID=P44
+ PARTITION_ID=P44
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P44
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P44
+ (( I=I+1 ))
+ '[' 45 -le 48 ']'
+ [[ 45 -lt 10 ]]
+ export PARTITION_ID=P45
+ PARTITION_ID=P45
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P45
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P45
+ (( I=I+1 ))
+ '[' 46 -le 48 ']'
+ [[ 46 -lt 10 ]]
+ export PARTITION_ID=P46
+ PARTITION_ID=P46
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P46
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P46
+ (( I=I+1 ))
+ '[' 47 -le 48 ']'
+ [[ 47 -lt 10 ]]
+ export PARTITION_ID=P47
+ PARTITION_ID=P47
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P47
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P47
+ (( I=I+1 ))
+ '[' 48 -le 48 ']'
+ [[ 48 -lt 10 ]]
+ export PARTITION_ID=P48
+ PARTITION_ID=P48
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170731.extract.01_6_2017.P48
+ test -r ar.ARCD-01.20170731.extract.01_6_2017.P48
+ (( I=I+1 ))
+ '[' 49 -le 48 ']'
 
if [ (${FILE_COUNT} -eq 0) || (${FILE_COUNT} -lt ${NUM_CHG_PARTS}) ]
/dbl_sh_unc/fs_users/oprtub01/users/shweta_backup/ARAMDPCYCREP/arcd01: line 645: syntax error near unexpected token `${FILE_COUNT}'
/dbl_sh_unc/fs_users/oprtub01/users/shweta_backup/ARAMDPCYCREP/arcd01: line 645: `if [ (${FILE_COUNT} -eq 0) || (${FILE_COUNT} -lt ${NUM_CHG_PARTS}) ]'
Application run ended
Application run ended with failure.
Post error application script run started.


#9 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:06:32 AM

Posted 07 August 2017 - 06:40 PM

Please use the " <> " code button to paste code into next time. It is in between the image and quote buttons on the toolbar.

 

So I see

 ((FILE_COUNT=FILE_COUNT+1))

The reason it wouldn't iterate is because it needs to be

 ((FILE_COUNT=$FILE_COUNT+1))

Your code doesn't know what "FILE_COUNT" is with out the dollar sign.


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#10 genius_mind

genius_mind
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:06:32 AM

Posted 08 August 2017 - 10:40 AM

Hi i tried with adding $FILE_COUNT but still file_count is getting only 0 value.

 

I have pasted the code for iteration here.

 

thanks a lot for ur help

if [[ ${NUM_CHG_PARTS} -eq 0 ]]
then
  COUNT=1
else
  ((COUNT=NUM_CHG_PARTS))
fi
+ [[ 48 -eq 0 ]]
+ (( COUNT=NUM_CHG_PARTS ))


I=1
+ I=1
FILE_COUNT=0
+ FILE_COUNT=0
while [[ ${I} -le ${COUNT} ]]
do
  if [[ ${I} -lt 10 ]]
  then
    export PARTITION_ID="P0"${I}
  else
    export PARTITION_ID="P"${I}
  fi

  CD01_EXTRACT_FILE_TEMP='ar.ARCD-01.'$REPORT_DATE'.extract.'$CYCLE_NO'_'$CYCLE_MM'_'$CYCLE_YYYY.$PARTITION_ID
  if (test -r $CD01_EXTRACT_FILE_TEMP)
  then
     cat $CD01_EXTRACT_FILE_TEMP >> $CD01_EXTRACT_FILE
     ((FILE_COUNT=$FILE_COUNT+1))
  fi
  ((I=I+1))
done
+ [[ 1 -le 48 ]]
+ [[ 1 -lt 10 ]]
+ export PARTITION_ID=P01
+ PARTITION_ID=P01
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P01
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P01
+ (( I=I+1 ))
+ [[ 2 -le 48 ]]
+ [[ 2 -lt 10 ]]
+ export PARTITION_ID=P02
+ PARTITION_ID=P02
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P02
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P02
+ (( I=I+1 ))
+ [[ 3 -le 48 ]]
+ [[ 3 -lt 10 ]]
+ export PARTITION_ID=P03
+ PARTITION_ID=P03
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P03
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P03
+ (( I=I+1 ))
+ [[ 4 -le 48 ]]
+ [[ 4 -lt 10 ]]
+ export PARTITION_ID=P04
+ PARTITION_ID=P04
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P04
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P04
+ (( I=I+1 ))
+ [[ 5 -le 48 ]]
+ [[ 5 -lt 10 ]]
+ export PARTITION_ID=P05
+ PARTITION_ID=P05
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P05
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P05
+ (( I=I+1 ))
+ [[ 6 -le 48 ]]
+ [[ 6 -lt 10 ]]
+ export PARTITION_ID=P06
+ PARTITION_ID=P06
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P06
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P06
+ (( I=I+1 ))
+ [[ 7 -le 48 ]]
+ [[ 7 -lt 10 ]]
+ export PARTITION_ID=P07
+ PARTITION_ID=P07
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P07
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P07
+ (( I=I+1 ))
+ [[ 8 -le 48 ]]
+ [[ 8 -lt 10 ]]
+ export PARTITION_ID=P08
+ PARTITION_ID=P08
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P08
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P08
+ (( I=I+1 ))
+ [[ 9 -le 48 ]]
+ [[ 9 -lt 10 ]]
+ export PARTITION_ID=P09
+ PARTITION_ID=P09
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P09
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P09
+ (( I=I+1 ))
+ [[ 10 -le 48 ]]
+ [[ 10 -lt 10 ]]
+ export PARTITION_ID=P10
+ PARTITION_ID=P10
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P10
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P10
+ (( I=I+1 ))
+ [[ 11 -le 48 ]]
+ [[ 11 -lt 10 ]]
+ export PARTITION_ID=P11
+ PARTITION_ID=P11
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P11
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P11
+ (( I=I+1 ))
+ [[ 12 -le 48 ]]
+ [[ 12 -lt 10 ]]
+ export PARTITION_ID=P12
+ PARTITION_ID=P12
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P12
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P12
+ (( I=I+1 ))
+ [[ 13 -le 48 ]]
+ [[ 13 -lt 10 ]]
+ export PARTITION_ID=P13
+ PARTITION_ID=P13
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P13
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P13
+ (( I=I+1 ))
+ [[ 14 -le 48 ]]
+ [[ 14 -lt 10 ]]
+ export PARTITION_ID=P14
+ PARTITION_ID=P14
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P14
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P14
+ (( I=I+1 ))
+ [[ 15 -le 48 ]]
+ [[ 15 -lt 10 ]]
+ export PARTITION_ID=P15
+ PARTITION_ID=P15
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P15
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P15
+ (( I=I+1 ))
+ [[ 16 -le 48 ]]
+ [[ 16 -lt 10 ]]
+ export PARTITION_ID=P16
+ PARTITION_ID=P16
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P16
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P16
+ (( I=I+1 ))
+ [[ 17 -le 48 ]]
+ [[ 17 -lt 10 ]]
+ export PARTITION_ID=P17
+ PARTITION_ID=P17
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P17
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P17
+ (( I=I+1 ))
+ [[ 18 -le 48 ]]
+ [[ 18 -lt 10 ]]
+ export PARTITION_ID=P18
+ PARTITION_ID=P18
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P18
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P18
+ (( I=I+1 ))
+ [[ 19 -le 48 ]]
+ [[ 19 -lt 10 ]]
+ export PARTITION_ID=P19
+ PARTITION_ID=P19
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P19
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P19
+ (( I=I+1 ))
+ [[ 20 -le 48 ]]
+ [[ 20 -lt 10 ]]
+ export PARTITION_ID=P20
+ PARTITION_ID=P20
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P20
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P20
+ (( I=I+1 ))
+ [[ 21 -le 48 ]]
+ [[ 21 -lt 10 ]]
+ export PARTITION_ID=P21
+ PARTITION_ID=P21
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P21
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P21
+ (( I=I+1 ))
+ [[ 22 -le 48 ]]
+ [[ 22 -lt 10 ]]
+ export PARTITION_ID=P22
+ PARTITION_ID=P22
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P22
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P22
+ (( I=I+1 ))
+ [[ 23 -le 48 ]]
+ [[ 23 -lt 10 ]]
+ export PARTITION_ID=P23
+ PARTITION_ID=P23
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P23
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P23
+ (( I=I+1 ))
+ [[ 24 -le 48 ]]
+ [[ 24 -lt 10 ]]
+ export PARTITION_ID=P24
+ PARTITION_ID=P24
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P24
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P24
+ (( I=I+1 ))
+ [[ 25 -le 48 ]]
+ [[ 25 -lt 10 ]]
+ export PARTITION_ID=P25
+ PARTITION_ID=P25
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P25
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P25
+ (( I=I+1 ))
+ [[ 26 -le 48 ]]
+ [[ 26 -lt 10 ]]
+ export PARTITION_ID=P26
+ PARTITION_ID=P26
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P26
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P26
+ (( I=I+1 ))
+ [[ 27 -le 48 ]]
+ [[ 27 -lt 10 ]]
+ export PARTITION_ID=P27
+ PARTITION_ID=P27
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P27
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P27
+ (( I=I+1 ))
+ [[ 28 -le 48 ]]
+ [[ 28 -lt 10 ]]
+ export PARTITION_ID=P28
+ PARTITION_ID=P28
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P28
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P28
+ (( I=I+1 ))
+ [[ 29 -le 48 ]]
+ [[ 29 -lt 10 ]]
+ export PARTITION_ID=P29
+ PARTITION_ID=P29
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P29
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P29
+ (( I=I+1 ))
+ [[ 30 -le 48 ]]
+ [[ 30 -lt 10 ]]
+ export PARTITION_ID=P30
+ PARTITION_ID=P30
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P30
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P30
+ (( I=I+1 ))
+ [[ 31 -le 48 ]]
+ [[ 31 -lt 10 ]]
+ export PARTITION_ID=P31
+ PARTITION_ID=P31
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P31
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P31
+ (( I=I+1 ))
+ [[ 32 -le 48 ]]
+ [[ 32 -lt 10 ]]
+ export PARTITION_ID=P32
+ PARTITION_ID=P32
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P32
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P32
+ (( I=I+1 ))
+ [[ 33 -le 48 ]]
+ [[ 33 -lt 10 ]]
+ export PARTITION_ID=P33
+ PARTITION_ID=P33
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P33
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P33
+ (( I=I+1 ))
+ [[ 34 -le 48 ]]
+ [[ 34 -lt 10 ]]
+ export PARTITION_ID=P34
+ PARTITION_ID=P34
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P34
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P34
+ (( I=I+1 ))
+ [[ 35 -le 48 ]]
+ [[ 35 -lt 10 ]]
+ export PARTITION_ID=P35
+ PARTITION_ID=P35
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P35
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P35
+ (( I=I+1 ))
+ [[ 36 -le 48 ]]
+ [[ 36 -lt 10 ]]
+ export PARTITION_ID=P36
+ PARTITION_ID=P36
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P36
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P36
+ (( I=I+1 ))
+ [[ 37 -le 48 ]]
+ [[ 37 -lt 10 ]]
+ export PARTITION_ID=P37
+ PARTITION_ID=P37
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P37
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P37
+ (( I=I+1 ))
+ [[ 38 -le 48 ]]
+ [[ 38 -lt 10 ]]
+ export PARTITION_ID=P38
+ PARTITION_ID=P38
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P38
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P38
+ (( I=I+1 ))
+ [[ 39 -le 48 ]]
+ [[ 39 -lt 10 ]]
+ export PARTITION_ID=P39
+ PARTITION_ID=P39
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P39
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P39
+ (( I=I+1 ))
+ [[ 40 -le 48 ]]
+ [[ 40 -lt 10 ]]
+ export PARTITION_ID=P40
+ PARTITION_ID=P40
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P40
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P40
+ (( I=I+1 ))
+ [[ 41 -le 48 ]]
+ [[ 41 -lt 10 ]]
+ export PARTITION_ID=P41
+ PARTITION_ID=P41
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P41
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P41
+ (( I=I+1 ))
+ [[ 42 -le 48 ]]
+ [[ 42 -lt 10 ]]
+ export PARTITION_ID=P42
+ PARTITION_ID=P42
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P42
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P42
+ (( I=I+1 ))
+ [[ 43 -le 48 ]]
+ [[ 43 -lt 10 ]]
+ export PARTITION_ID=P43
+ PARTITION_ID=P43
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P43
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P43
+ (( I=I+1 ))
+ [[ 44 -le 48 ]]
+ [[ 44 -lt 10 ]]
+ export PARTITION_ID=P44
+ PARTITION_ID=P44
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P44
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P44
+ (( I=I+1 ))
+ [[ 45 -le 48 ]]
+ [[ 45 -lt 10 ]]
+ export PARTITION_ID=P45
+ PARTITION_ID=P45
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P45
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P45
+ (( I=I+1 ))
+ [[ 46 -le 48 ]]
+ [[ 46 -lt 10 ]]
+ export PARTITION_ID=P46
+ PARTITION_ID=P46
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P46
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P46
+ (( I=I+1 ))
+ [[ 47 -le 48 ]]
+ [[ 47 -lt 10 ]]
+ export PARTITION_ID=P47
+ PARTITION_ID=P47
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P47
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P47
+ (( I=I+1 ))
+ [[ 48 -le 48 ]]
+ [[ 48 -lt 10 ]]
+ export PARTITION_ID=P48
+ PARTITION_ID=P48
+ CD01_EXTRACT_FILE_TEMP=ar.ARCD-01.20170801.extract.01_6_2017.P48
+ test -r ar.ARCD-01.20170801.extract.01_6_2017.P48
+ (( I=I+1 ))
+ [[ 49 -le 48 ]]
echo $FILE_COUNT
+ echo 0
0
if [[ (${FILE_COUNT} -eq 0) || (${FILE_COUNT} -lt ${NUM_CHG_PARTS}) ]]
then
  echo "Not all the Extract files were created"
  TlgFilePlacer $IR01_EXTRACT_FILE FAILURE
  ExitProcess 1
fi
+ [[ 0 -eq 0 ]]
+ echo 'Not all the Extract files were created'
Not all the Extract files were created
+ TlgFilePlacer FAILURE



#11 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:06:32 AM

Posted 08 August 2017 - 11:41 AM

So you file_count iterator looks right. But I'm seeing a trend. You have a lot of variables you try and do things with, but you are missing the '$' before the variable.

 

Go through your code and make sure you are calling variables correctly. That could be messing things up.


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#12 genius_mind

genius_mind
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:06:32 AM

Posted 08 August 2017 - 04:11 PM

I checked for all but it has problem with file_count only

as its not getting file_count=$file_count+1 its not infringementing the value it is just keeping it 0 as we assigned earlier

 

Thanks for ur help



#13 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:06:32 AM

Posted 08 August 2017 - 04:13 PM

One extremely helpful thing to do is use print (or in this case echo) statements to see where your code is going/doing. If file_count is incrementing then your code probably is not hitting that IF statement it is in. I would check to see why that is.


Edited by DeimosChaos, 08 August 2017 - 04:14 PM.

OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#14 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:06:32 AM

Posted 08 August 2017 - 04:24 PM

What are you trying to check in that if statement?  -r seems to indicate "if the file is readable", is that what you want?  Just above the if put an ls -l of CD01_EXTRACT_FILE_TEMP.  If that does not show what the "test -r" is checking, then that's why your if is not passing.  Basically, what I suggested back up in #3.

 

test -r is: True if file exists and is readable.

 

If you are not getting inside that if then the either does not exist or it is not readable.  Simple to see by adding an ls -l right before the if.


Edited by mremski, 08 August 2017 - 04:26 PM.

FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#15 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:06:32 AM

Posted 09 August 2017 - 12:08 AM

*mremski has some good info there!!

I completely missed your first post, mremski, or I would have said do what you said!

 

So OP, do as mremski suggested.


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users