The Shell Programming code to generate the reverse of given string, We can make a output of reversed string for the given string, by using a variable to store the user inputs,Program source code given below,
Please save this source using <filename>.sh extension,
Source code for conertion :
[sourcecode language=’css’]
clear
echo “Enter the string:-”
Read str
len = ` $str | wc-w `
while [ $len –gt 0 ]
do
temp = ` $str | wt-c $ len `
rev= ` $rev $temp `
len= ` expr $len-1 `
done
echo “The reversed string is :- $rev”
[/sourcecode]
To copy above source code, Use pastebin
You may also refer
$ echo french | rev
hcnerf