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 are the disadvantages of shell scripting?

720


What is gui scripting?

699


What is an inode block?

670


How does shell scripting work?

711


Write down the syntax of "for " loop

704






What are the various stages of a linux process it passes through?

722


How to print pid of the current shell?

673


What makes c shell a more preferable option than the bourne shell?

624


what is info area how many types?

2386


What is awk in shell script?

838


c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

4798


How do I save a powershell script?

646


What does sh mean?

697


What is the meaning of $1 in shell script?

697


What language is bash?

566