Skip to main content

shell - Compare two strings- bash


echo "enter 2 strings "
read s
read s2
if [ $s = $s2 ]
then
echo "Strings are equal"
else
       
echo "Strings are not equal"

    if [ $s \< $s2 ]
    then
    echo "String $s comes first"
    else
    echo "String $s2 comes first"
    fi
fi

Comments

Popular posts from this blog

unix commands