clear
echo "Enter a number"
read n
sd=0
rev=0
while [ $n -gt 0 ]
do
sd=$(( $n % 10 ))
rev=$(( $rev \ 10 + $sd ))
n=$(( $n / 10 ))
done
echo "Reverse number of entered digit is $rev"
From the above code I am unable to get the required output. Instead, this error is displayed.
./Display: line 17: 0 \ 10 + 4 : syntax error: operand expected (error token is "\ 10 + 4 ")
Reverse number of entered digit is 0
I don't know why this error is displayed, please help me to figure it out.