Results 1 to 4 of 4
Hi ,
Caan any one plz helpp me in this...'
i got a script like this
#!/bin/sh
sch = 0
echo "enter
echo "1.Usch.sh"
echo "2.Ssp.sh"
echo "3.uscr_final"
echo "4.fttp"
...
- 12-28-2009 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 3
need help in shell scripting
Hi ,
Caan any one plz helpp me in this...'
i got a script like this
#!/bin/sh
sch = 0
echo "enter
echo "1.Usch.sh"
echo "2.Ssp.sh"
echo "3.uscr_final"
echo "4.fttp"
read sch
if [$sch -eq 1] ; then
./Usch.sh
else if [$sch -eq 2]; then
./Scp.sh
else if [$sch -eq 3]; then
./uscr_final.sh
else if [$sch -eq 4]; then
./fttp.sh
fi
while i am trying to execute this one it is giving the error like
else is not matched at he last else statement..
thanks in advance..
- 12-28-2009 #2
I assume every if needs to have a fi.
Debian GNU/Linux -- You know you want it.
- 12-28-2009 #3Just Joined!
- Join Date
- Dec 2009
- Posts
- 3
adding fi to every if is also not working
- 12-29-2009 #4
couple of things..
first you need the closing quotes on the first echo statement.
your test statements need a space around them.Code:echo "enter"
change else if to elifCode:[ $sch -eq 1 ]
I may be wrong but I think the construct will also need a final "else" statementCode:elif [$sch -eq 2]; then
You should look in to the case constructCode:else echo "Invalid choice"
Bash by example, Part 2
Using case statements


Reply With Quote