[KLUG Members] scripting question
Wesley Leonard
members@kalamazoolinux.org
Wed, 29 May 2002 01:05:27 -0400
Instead of using =, use -eq, like this:
if [ $value -eq 1 ]
Here's a good reference, the Advanced Bash Scripting Guide:
http://www.tldp.org/LDP/abs/html/
l8er
Rusty Yonkers wrote:
>
> Ok ... now most of you will be thinking .... "well duh" ... but I am
> not a scripting guru. So I pose my most simple question most humbly
> and hope that the reverberations of laughter do not create an
> earthquake.
>
> I am trying to get a piece of scripting to work for an evaluation
> using test but it is not evaluating correctly. The portion of the
> script that is not working is
>
> echo -n "Enter a number: "
>
> read value
>
> if [ $value = 1 ]
>
> then
> echo "You have entered 1"
> else
> echo "You have not entered 1"
> echo "You have entered $value"
> fi
>
> The problem is that the test always responds with a false results!
> Aaaaaagggghhhh!
>
> Any idea what I am doing wrong?
>
> TIA
>
> =====
> Truth is truth ... no matter what I think...
> -----------------------------------------
> Department of Redundancy Department
> -----------------------------------------
> Devoted RedHat fan...
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
>
--
Wesley Leonard
marshall@pacdemon.org http://pacdemon.org
marshall@westmichigancomputing.com http://westmichigancomputing.com
"Rather than form a federation with Microsoft and work with what we had already
created, there was this notion that the world should be offered an alternative."
-- Craig Mundie, CTO of Microsoft Corporation