[NTLUG:Discuss] sh question - extra eyes needed

Fred James fredjame at concentric.net
Tue Jun 24 14:08:17 CDT 2003


Greg Edwards wrote:

> 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
>
Thanks - good thoughts.
(1) Yes, $System has a value in it, so that was not an issue in this case.
(2) Yes (after testing), appearently the ending EOF must start in column 
1 - moving it there got me past the syntax error, and so happily on to 
other debugging.


-- 
...small is beautiful





More information about the Discuss mailing list