On Fri, 11 Feb 2022 18:33:41 -0400, Kurt J. Quackenbush wrote:
>
>Try like this:
>
>pet=dog;
>if [ $pet -eq "dog" ]; then
>
"-eq" compares numbers; "=" compares strings. Example:
537 $ [ 00042 -eq 42 ]; echo $?
0
538 $ [ 00042 = 42 ]; echo $?
1
539 $
And "$pet" needs to be quoted lest a user sneak in:
pet="Tasmanian Devil"
> echo "feed dog";
>else
> echo "feed cat";
>fi;
--
gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN