The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-05-2008
BigSky BigSky is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 14
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

  #2 (permalink)  
Old 12-05-2008
zaxxon's Avatar
zaxxon zaxxon is online now Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,323
Please show the line with the find command without using "set -x" or at least while variables being not substituted.
  #3 (permalink)  
Old 12-05-2008
BigSky BigSky is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 14

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

  #4 (permalink)  
Old 12-05-2008
zaxxon's Avatar
zaxxon zaxxon is online now Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,323
What's the variable? $LOG or $LOG_path?
Best write your variables like this to protect them when adjacent to other characters:

Code:
${LOG} 
# or
${LOG_path}   # if _path is part of the variable name

In your 1st post there was maybe only a partial substitution of your variable:
Quote:
find $u06_path .......
  #5 (permalink)  
Old 12-05-2008
BigSky BigSky is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 14
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0