Write a shell script to find the reverse of a string?



echo “enter the string”
read str
len = `expr $str /wc –c`
while [ $ len != 0 ]
do
temp = ` expr $str / cut –c  $len`
revstr = $revstr $temp
len = `expr $len -1`
done
echo $ revstr
OUTPUT:
enter the string
hello                          
revstr     olleh

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart