Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

palindrome in shell script

num=545
   
# Storing the remainder
s=0
   
# Store number in reverse 
# order
rev=""
   
# Store original number 
# in another variable
temp=$num
   
while [ $num -gt 0 ]
do
    # Get Remainder
    s=$(( $num % 10 ))  
      
    # Get next digit
    num=$(( $num / 10 )) 
      
    # Store previous number and
    # current digit in reverse 
    rev=$( echo ${rev}${s} ) 
done
   
if [ $temp -eq $rev ];
then
    echo "Number is palindrome"
else
    echo "Number is NOT palindrome"
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: autopep8 command command 
Shell :: update manjaro system 
Shell :: reverse shell bash 
Shell :: ubuntu install vboxguest 
Shell :: linux remove nested files with names 
Shell :: spring shell inside docker 
Shell :: generate ssh key paitr 
Shell :: add all files in directory to git 
Shell :: powershell get serial number 
Shell :: kubectl restart deployment 
Shell :: pycharm community install ubuntu 
Shell :: ffmpeg shrink video size 
Shell :: spec false not working 
Shell :: ubuntu check computer architecture 
Shell :: copy file permission denied arch 
Shell :: git log --graph 
Shell :: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted 
Shell :: trojitá ubuntu 
Shell :: git reload .gitignore file 
Shell :: docker run ubuntu image 
Shell :: how to search all subfolders in linux for file 
Shell :: portainer install ubuntu 
Shell :: git discard all changes command 
Shell :: bash remove first character 
Shell :: find bashrc 
Shell :: linux find text in pdf file 
Shell :: install xrdp ubuntu 18.04 
Shell :: how to delete a word from a file in bash 
Shell :: bily-101 github 
Shell :: how to download mavem 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =