write a shell script to identify the given string is
palindrome or not?

Answer Posted / prasath

echo"to check whether given string is palindrom or not"
echo"Enter the string"
read str
Len=$(echo "$str"| wc -c
while [$len -gt 0]
do
ch=$(echo "$str"| cut -c $len)
echo -n "$ch"
s1=$s1$ch
Len =`expr $len -1`
done
echo""
if [$s1 != $str]
Then
echo "Tha string is not palindrom"
else
echo"The string is palindrom"
fi

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the syntax of "nested if statement" in shell scripting?

629


one folder contains lot of students name but I want to fetch hello with every student name individually using shell script

511


Explain about login shell?

633


What are the four fundamental components of every file system on linux?

1157


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

525






Why do we use shell scripting?

547


What language is bash?

489


What's the difference between scripting and coding?

595


What is difference between shell and bash scripting?

541


How do I save a powershell script?

555


Write a shell script to get current date, time, user name and current working directory.

631


What can you do with powershell?

603


What does $@ mean in shell?

590


Explain about the exit command?

566


What is shell scripting?

589