I used set -n FS.sh to check for syntax errors. No problems. I run the script with set -x and set -v with the following error:
find: bad option ;
find: path-list predicate-list
Reviewing the verbose output everything is read correctly. The files transfer and the script completes. I can't seem to narrow the problem down. Any suggestion would be greatly appreciated as to what might be wrong.
find $u06_path -name "e*${u06_dmp_file}.dmp.gz" | while read file #while loop to parse list
do
scp -rp $file $RemoteServer
if [[ $? -ne 0 ]]
then
echo "" >> $LOG_path/FS_`date +%Y%m%d`.log
echo "SCP exit status is" "$?" >> $LOG_path/FS_`date +%Y%m%d`.log
echo "SCP Failed" >> $LOG_path/FS_`date +%Y%m%d`.log
echo "" >> $LOG_path/FS_`date +%Y%m%d`.log
else
rm $file
echo "SCP exit status is" "$?" >> $LOG_path/FS_`date +%Y%m%d`.log
echo "SCP Passed for " $file >> $LOG_path/FS_`date +%Y%m%d`.log
fi
done
Good point about isolating the variables. When the script was set to -x I verified variable substitution. I'll go back make corrects to variables with curly braces and run it again.
The thing that gets me is why would the script process the files when an error like this occurs. When I miss a double quote around -name option find command explodes with similar error. So I thought I was missing syntax.