Hi,
I am trying to read the contents of a file using array credentials in unix. The file I am trying to read is tab separated and contains the below contents.
# partnerid Direc Server Port Source_Dir Target_Dir Mask Remove Files Passwordless Compare Files CopyLatest
I am reading the lines using a while loop and setting values using below command.
set -A CREDENTIALS_ARRAY ${line}
The first time I run the script it sets all the 11 parameters correctly in the array and script executes fine.Basically I read the contents to transfer the file $Mask from source to destination. Have shown sample files below. Mask has been set to achan* When I execute the script the second time it sets Mask=achan_dwh.sas7bdat and Remove Files=achan_dwh.sas7bndx , hence shifting the values forward by 1 parameter thereby setting the value of Remove Files into Passwordless field. Actually remove file is set to "N" and passwordless to "Y" but in this case sets passwordless to "N" and goes into the other section of the code to validate the Identity key which is wrong.
-rwxr-x--- 1 transfer sassrvOP 24576 May 12 19:26 achan_dwh.sas7bdat
-rwxr-x--- 1 transfer sassrvOP 24576 May 12 19:26 achan_dwh.sas7bndx
I suspect the array credentails is not getting cleared in the second run. IS there a way I could reset the array to zero each run or do you suspect some other issue here? Have not put the code since it is really huge.
It would be great if you could help me on this. Thanks in advance.