Header Ads Widget

Ticker

6/recent/ticker-posts

Write a shell script to check entered string is palindrome or not

 echo "Input your string without space"

read vstr
for i in $(seq 0 ${#vstr})
do
  rvstr=${vstr:$i:1}${rvstr}
done

echo "Input string was :" $vstr
echo "After Reversng String Is :" $rvstr

if [ "$vstr" = "$rvstr" ]
then
  echo "String Is Palindrome."
else
  echo "String Is Not Plaindrome."
fi

Post a Comment

0 Comments