Bash string comparision using “if”
”==” and “!=” only can be used in case of string comparision.
1
2
3
4
5
6
7
8
9
if [ "$STRING" == "abc" ];then
echo "STRING is abc!"
fi
or
if [ "$STRING" = "abc" ];then
echo "STRING is abc!"
fi
”==” and “!=” only can be used in case of string comparision.
1
2
3
4
5
6
7
8
9
if [ "$STRING" == "abc" ];then
echo "STRING is abc!"
fi
or
if [ "$STRING" = "abc" ];then
echo "STRING is abc!"
fi
Comments powered by Disqus.