LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   if then statements (https://www.linuxquestions.org/questions/programming-9/if-then-statements-72748/)

vapor 07-14-2003 07:16 PM

if then statements
 
say i wanted to ask a yes or no question and print diffent answers depending on the answer..... how would i go about do that

bash script


all help is appreciated

Tinkster 07-14-2003 07:21 PM

http://www.tldp.org/LDP/abs/html/tests.html

Have fun reading ;)

Cheers,
Tink

vapor 07-14-2003 07:47 PM

it didnt help... thanks there

Mohsen 07-15-2003 01:57 AM

#!/bin/bash
#I'm rather newbie in bash script :)

echo Enter yes or no please :)
read var
if ["$var" = yes]
then
echo You entered yes
elif ["$var" = no]
echo You entered no
else
echo Can not evaluate answer
fi

dharmender_rai 07-16-2003 06:44 AM

also you can use "case" instead of "if" .


All times are GMT -5. The time now is 10:30 AM.