[NTLUG:Discuss] OT shell script question

fredjame fredjame at fredjame.cnc.net
Wed Mar 3 19:50:17 CST 2004


I am embedding a smbclient session within a (sh) shell script.  The 
session works fine, but I need to capture a meaningful return code, if 
there is such a thing.  In the snippet below you can see that I have 
tried moving the "ReturnCode=$?" line around.  But all I ever get is a 
"0" even on failure.

In short, I need a way of passing back to a calling program "yes, it 
worked" or "no, it didn't work".  Thank you in advance for any help you 
may be able to offer.
Regards
Fred James

<snippet>
$SMBcmd <<EOF 2>&1 >> $LOGFILE
cd $Path
put $Text $FileName
exit
ReturnCode=$?
EOF
# ReturnCode=$?
 
echo "Return code: $ReturnCode"
exit $ReturnCode
</snippet>

-- 
...we are fellow passengers...





More information about the Discuss mailing list