[ale] Dumb shell scripting question
Ken Nagorski
kenn at pcintelligent.com
Wed Mar 21 14:45:05 EST 2001
Ok, thanks...
Man. I am losing it, cause I must have known that at some point in time.
On Wed, 21 Mar 2001, Byron A Jeff wrote:
> >
> > 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.
> >
>
--
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.
More information about the Ale
mailing list