You are currently viewing Reverse the String using Shell Programming

Reverse the String using Shell Programming

  • Post author:
  • Post category:Linux
  • Post comments:1 Comment
  • Reading time:2 mins read

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 

Balaji

, is a computer science graduate. He is interested in sharing the system tweaking ,Web-designing, SEO and tips to use your system fetching you utmost use. Happy tweaking! :D

This Post Has One Comment

Leave a Reply