Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String comparison Shell script

 
kri shan
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was no ; after ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic