comparing strings

 

=======================================================
#comparing strings
=======================================================
#! bin/bash
# comparing strings

echo "enter the 1st string"
read st1
echo "enter the 2nd string"
read st2

if [ "$st1" == "$st2" ]
then
echo "both strings matched"
else
echo "both strings not matched"
fi


[prabhucloudxlab@cxln4 ~]$ sh hello.sh
enter the 1st string
linuxhint
enter the 2nd string
abc
both strings not matched



[prabhucloudxlab@cxln4 ~]$ sh hello.sh
enter the 1st string
linuxhint
enter the 2nd string
linuxhint
both strings matched



[prabhucloudxlab@cxln4 ~]$ sh hello.sh
enter the 1st string
abc
enter the 2nd string
abd
both strings not matched



#Note: 
comparing order of strings only... not comparing length of the strings