![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C Question compilation error | jaganreddy | High Level Programming | 1 | 05-12-2008 11:05 AM |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| Newb scripting question, I get the error script not found | Arkitech | Shell Programming and Scripting | 3 | 05-04-2006 11:55 AM |
| Question about error | Howeird | UNIX for Advanced & Expert Users | 3 | 04-26-2002 08:59 AM |
| Error Question | djatwork | UNIX for Dummies Questions & Answers | 4 | 10-04-2001 06:47 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Question on error from script
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. Code:
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
|
|
||||
|
Code:
#if fs > threshold find files to move to different filesystem
if [[ $UsedSpace_u06 -gt $Threshold_u06 ]]
then
find $LOG_path -name "FS_*.log" -mtime +4 -exec rm '{}' +
echo "" >> $LOG_path/FS_`date +%Y%m%d`.log
echo "Files to be copied to XXXX..." >> $LOG_path/FS_`date +%Y%m%d`.log
find $u06_path -name "e*${u06_dmp_file}.dmp.gz" >> $LOG_path/FS_`date +%Y%m%d`.log \;
find $u06_path -name "${u06_dmp_file}" >> $LOG_path/FS_`date +%Y%m%d`.log \;
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
fi
find: bad option ;
find: path-list predicate-list
find: bad option ;
find: path-list predicate-list
|
|
||||
|
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. Thanks for the suggestions. Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|