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
enter the string
hello
revstr
olleh
Comments
Post a Comment