[SLE] bash programming help is needed...
if [ -z "$INPUTLOG" ] || [ -z "$OUTPUTLOG" ] || [ -z "$NOTESBIN" ] || [ -z "$NOTESDATA" ] then echo 'ERROR, not all enviornment variables are set...' echo '$INPUTLOG='$INPUTLOG echo '$OUTPUTLOG='$OUTPUTLOG echo '$NOTESBIN='$NOTESBIN echo '$NOTESDATA='$NOTESDATA exit 1 fi For some reaons the code above is not being liked by bash. I don't see a problem, can someone help me out? What I am trying to do is check for the four enviornment variables and if they are NOT set, I want to exit the script. ANTHOER Q: I would also like to check and make sure that the script is being run as a certain user, like 'fred', how can I check to see if 'fred' is the user that this script is executing as? Sam -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Hi, On Sat, Jan 15, 2000 at 17:13 -0500, Sam Carleton wrote:
if [ -z "$INPUTLOG" ] || [ -z "$OUTPUTLOG" ] || [ -z "$NOTESBIN" ] || [ -z "$NOTESDATA" ] then echo 'ERROR, not all enviornment variables are set...' echo '$INPUTLOG='$INPUTLOG echo '$OUTPUTLOG='$OUTPUTLOG echo '$NOTESBIN='$NOTESBIN echo '$NOTESDATA='$NOTESDATA exit 1 fi
For some reaons the code above is not being liked by bash. I don't see a problem, can someone help me out?
That would be much easier if you had posted the error message bash gave you. The code is correct and runs just fine. Make sure you don't have a line break in the first line after the `|| [', as this will cause errors.
ANTHOER Q: I would also like to check and make sure that the script is being run as a certain user, like 'fred', how can I check to see if 'fred' is the user that this script is executing as?
`whoami' will tell you. Ciao, Stefan -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
On Sat, Jan 15, 2000 at 05:13:18PM -0500, Sam Carleton wrote:
if [ -z "$INPUTLOG" ] || [ -z "$OUTPUTLOG" ] || [ -z "$NOTESBIN" ] || [ -z "$NOTESDATA" ] then
if [ -z "$INPUTLOG" -o -z "$OUTPUTLOG" -o -z "$NOTESBIN" ] ; then .... fi
For some reaons the code above is not being liked by bash. I don't see a problem, can someone help me out?
You forgot a ';' after the test. Cees -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
participants (3)
-
Anonymous User
-
cees-list@griend.xs4all.nl
-
sttr@sttr.de