Hi all Linux guys out there. I have been trying to make a shell script for finding reverse of an entered number. So I thought of starting with a 5-digit example. I can make a C program and compile it, but I need a shell script that can do it.
This may be very simple for most people out there and seemed simple to me toooo. But it seems to have problems in execution.
The code is below:
#Reverse a number
echo "Enter A Five Digit Number: "
read num
for x in 1 2 3 4 5
do
$num=`expr $num % 10`
$num=`expr $num / 10`
done
echo "Reverse of the number is $num1 $num2 $num3 $num4 $num5"
Question
sunbiz_3000
Hi all Linux guys out there. I have been trying to make a shell script for finding reverse of an entered number. So I thought of starting with a 5-digit example. I can make a C program and compile it, but I need a shell script that can do it.
This may be very simple for most people out there and seemed simple to me toooo. But it seems to have problems in execution.
The code is below:
Link to comment
Share on other sites
0 answers to this question
Recommended Posts