Operating System - HP-UX
1834814 Members
2787 Online
110070 Solutions
New Discussion

simple script case if then else issue

 
SOLVED
Go to solution
Doug_3
Frequent Advisor

simple script case if then else issue

Embarassing...ksh generates "unexpected fi" and I can't resolve the syntax...must be friday late pm brain dead. Help please. Thanks Doug

case $2
in
test_str)
if [ $5 = "test_str" ] then
echo $1 $2 $3 $4 $5
fi
;;

other_str)
similar cmds
;;

esac
2 REPLIES 2
Patrick Wallek
Honored Contributor
Solution

Re: simple script case if then else issue

What about just adding a semi-colon between the ] and the then statement:

if [ $5 = "test_str" ] ; then
Mic V.
Esteemed Contributor

Re: simple script case if then else issue

Add a semicolon:

;

after the "]" or move "then" to a separate line.

if [ $5 = "test_str" ] ; then

if [ $5 = "test_str" ]
then

:-)

BTDTGTTS.

Mic
What kind of a name is 'Wolverine'?