kayvan@mrspoc.transact.com (08/05/89)
The following obviously wrong shell script:
------------------------------ begin
#!/bin/bash
if Your_Mother_Wears_Army_Boots
then
How about we go out tonight?
No way, Jose!
NO_ENDING_FI
------------------------------ end
Is silently ignored. The status upon return in 0.
I found this bug in the following subtle case:
------------------------------ begin
#!/bin/bash - Test shell script
if [ "$LOGNAME" != "" ]
then
export USER=$LOGNAME ; echo USER set to LOGNAME
else
export USER=`who am i | awk '{print $1}'`
echo USER set to who output. $USER
endif
echo "Rest of script follows."
echo "Hello????"
------------------------------ end
The script *looked* okay, but all variables after this section that depended
on USER were not being set.
The problem was, of course, the endif.
---Kayvan
Kayvan Sylvan @ Transact Software, Inc. -*- Mountain View, CA (415) 961-6112
Internet: kayvan@Transact.COM -*- UUCP: ...!{apple,pyramid,mips}!mrspoc!kayvan