Question #277009

Write a shell script to compare two strings input by the user for equality.

Expert's answer

read -p "Enter a string: " str1
  
if [ $str1 == "linux" ]
then
    echo "linux"
elif [ $str1 == "unix" ]
then
    echo "unix"
else
    echo "Neither linux nor unix"
fi
LATEST TUTORIALS
APPROVED BY CLIENTS