Thread View: gnu.bash.bug
1 messages
1 total messages
Started by kayvan
Fri, 04 Aug 1989 20:51
Bad bash bug regarding if statements
Author: kayvan
Date: Fri, 04 Aug 1989 20:51
Date: Fri, 04 Aug 1989 20:51
37 lines
1382 bytes
1382 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads