Custom Search

Saturday, 21 April 2012

Write a Linux shell script that reverses the string, Unix program to find shell script that reverses the string


Write a Linux shell script that reverses the string, Unix program to find shell script that reverses the string


Program
clear
echo "Enter any string:"
read a
b=$a
d='expr$a|wc-c'
c='expr$d-1'
while[$c-gt 0]
do
 n='expr$a|cut-c$c'
 r=$r$n
 c='expr$c-1
done
echo"Reverse string:"$r


Output:


Enter any string:
laptop
Reverse string: potpal
<<< Previous  ||  Current  ||  Next >>>  

No comments:

Post a Comment

Laptops