[NTLUG:Discuss] sh question - extra eyes needed

Greg Edwards greg at nas-inet.com
Tue Jun 24 13:20:24 CDT 2003


Fred James wrote:
> Sorry, I am probably just blind but I can not see the error here - any 
> "extra eyes" that would care to comment would be very much appreciated.
> 
> In the snippet below, I am getting the following error:
>      "./SID_hot.sh[75]: syntax error at line 82: "then" unmatched"
> (I have added "(line 82)" at the beginning of line 82 in the snippet)
> 
> [Bourne Shell script snippet]
> Hold=$HOLD
> while read Target Status Space
> do
>      Destination=`echo $Target | cut -f4 -d"/"`
>      Destination=$destDir$Destination
>      if test $Space != $Hold
>      then
>            if test $Hold != $System
> (line 82)   then
>                  sqlplus $USER_NAME/$USER_CODE@$ORACLE_SID << EOF
>                          alter tablespace $Hold end backup;
>                  EOF
>            fi
>            if test $Space != $System
>            then
>                  sqlplus $USER_NAME/$USER_CODE@$ORACLE_SID << EOF
>                          alter tablespace $Hold begin backup;
>                  EOF
>            fi
>            cp $Target $Destination
>            wait
>            gzip $Destination
>            wait
>      fi
> done < $dataTxt
> sqlplus $USER_NAME/$USER_CODE@$ORACLE_SID << EOF
>      alter tablespace $Hold end backup;
> EOF
> [end snippet]
> 

2 questions/comments

1.  Does System have anything in it?  If it's empty your compare world 
expand to (if test "something" != <cr>")

2.  I believe that the ending EOF "must" be the first item on the line 
or the shell keeps sucking data until the EOF at the end of the file 
before "end snippet"

HTH

-- 
Greg Edwards
New Age Software, Inc. - http://www.nas-inet.com
======================================================
Galactic Outlaw        - http://goutlaw.nas-inet.com
   The ultimate cyberspace adventure!




More information about the Discuss mailing list