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 in a script?

562


What is sed in shell script?

568


How do you create a shortcut in linux?

589


Write the syntax for "if" conditionals in linux?

591


What is .sh file in mac?

553






I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?

1680


How to print pid of the current shell?

598


How do we create command aliases in a shell?

534


What is the use of .sh file?

598


How do I read a .sh file?

529


Write down the syntax for all the loops in shell scripting.

656


How will you connect to a database server from linux?

553


How do I run a .sh file on mac?

669


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

627


How do I open the shell prompt?

571