Results 1 to 5 of 5
Hey,
I am very much new to shell scripting. Well I build one script in which i need if then else loop for Yes Or No options. Taking input of ...
- 08-15-2007 #1
If then Else if....
Hey,
I am very much new to shell scripting. Well I build one script in which i need if then else loop for Yes Or No options. Taking input of Yes and No from keyboard, It is exactly like this:-
If option=Yes
Execute some statements
Else if option=No
Execute some statements
But execute, it gives me Syntax error or command not found. Please tell me what should be exact syntax. I tried all permutations / combinations.Regards,
who |grep -i blonde |
date; cd~; unzip; touch;
strip; finger; mount; gasp;
yes; uptime; umount;
sleep

Newbie clicks
http://www.linuxforums.org/forum/lin...ead-first.html
- 08-15-2007 #2Code:
#!/bin/bash echo "Enter Option" read option if [ "$option" = "Yes" ]; then echo "its Yes" elif [ "$option" = "No" ]; then echo "its No" else echo "its neither Yes nor No" fiIt is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 08-15-2007 #3
Just fyi..
If then elsif else fi ... is not a loop. it's a statement.
- 08-16-2007 #4Yes. Its not a loop and I did that intentionally. Let Infoshirish do some research himself and that will help him more.
Originally Posted by Sangal-Arun It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 08-16-2007 #5
Hey,
I did some RnD and i got what i wanted, script working fine now. Anyways thanks for your greate help.
Regards,
who |grep -i blonde |
date; cd~; unzip; touch;
strip; finger; mount; gasp;
yes; uptime; umount;
sleep

Newbie clicks
http://www.linuxforums.org/forum/lin...ead-first.html


Reply With Quote