It's not a secret anymore!*
The moose likes Linux / UNIX and the fly likes String comparison Shell script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "String comparison Shell script" Watch "String comparison Shell script" New topic
Author

String comparison Shell script

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1365
sample.sh
----------
#!/bin/ksh

var1="test"
if [ "$var1" == "test" ] then
echo "correct string"
fi

./sample.sh gives syntax error at line 6: 'fi' unexpected. What is wrong ?


Sujoy Choudhury
Ranch Hand

Joined: Sep 17, 2008
Posts: 136

There was no ; after ]


Thanks and Regards,
~Sujoy
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: String comparison Shell script
 
Similar Threads
precedence
passing reference problem.......I think :confused:
Certification cx 310-035
JUnit testing
difference between ./sh and . ./sample.sh