[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Dumb shell scripting question
- Subject: [ale] Dumb shell scripting question
- From: byron at cc.gatech.edu (Byron A Jeff)
- Date: Wed, 21 Mar 2001 14:22:48 -0500 (EST)
>
> Hi there,
>
> I have stuff like this before but I am having a problem with this
> peice of code.
>
> echo -n "Are the drive ready to be formated and mounted? [y/n] "
> read confirm
> if [ $confirm=n ]
Your problem is right here. Spaces are significant in the shell. When using
test each word must be separated by space. Try this instead:
if [ "$confirm" = n ]
Use the double quotes just in case the user decides to enter nothing, so
that the script will generate an empty, yet valid, word if nothing is
entered at the propmt.
BAJ
> then
> echo "bye..."
> exit 0
> fi
>
> No matter what it exits... Maybe I am just going nuts. But I
> thought bash would return 1 only if the comparison was true. right? For
> some reason no matter what it echo's bye and exits. Hmm, not the desired
> result...
> Did I just lose my mind. Cause this is liek pretty simple bash no?
>
> OK, thanks
> Ken
>
> --
> I couldn't quite remember what I was going to say
> so I causally tip another sip of whatever it was I was drinking,
>
> --
> To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
>
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.