Fedora Linux Support Community & Resources Center
Prev Previous Post   Next Post Next
  #1  
Old 14th November 2011, 09:02 AM
menha Offline
Registered User
 
Join Date: Nov 2011
Posts: 3
windows_xp_2003firefox
Shell script to accept any input and reverses the order

Dear All I am trying to create a shell script that accepts any input and reverses the order. I came up with the code as below but however I don't seem to achieve my objective. Please members kindly tell me what problem is with my script


!/bin/sh
#
#
clear

#
#
echo -e "\n\n\nFor Example: Given 1234, I will print 4321.\n\n"

# echo -e "\n\nPlease enter a string of numbers:\n"

# read num
set num=1234
set rev=0
set tmp_num="$num"

while [ $num !=$rev ]
do

RMND=$num %10
rev=$RMND +10*$rev
num=$num / 10
done
echo -e "\nThe reverse of the Number $tmp_num is $rev"
Reply With Quote
 

Tags
accept, input, order, reverses, script, shell

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
fedora12 + arm-linux-insight: target port doesn't accept input webman Using Fedora 1 11th April 2010 11:35 AM
Texmaker won't accept input from keyboard on second editing pass kalwisti Using Fedora 8 18th June 2009 12:29 AM
call remote shell script within an expect script PhillyFloyd Programming & Packaging 2 16th October 2007 10:29 PM
starting a shell script inside a php script gw348 Using Fedora 6 23rd April 2007 09:30 PM


Current GMT-time: 20:14 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat