{"id":88,"date":"2024-12-25T10:11:03","date_gmt":"2024-12-25T10:11:03","guid":{"rendered":"https:\/\/alpeshconnect.in\/blog\/?p=88"},"modified":"2024-12-25T10:11:03","modified_gmt":"2024-12-25T10:11:03","slug":"shell-script-to-check-number-is-palindrome","status":"publish","type":"post","link":"https:\/\/alpeshconnect.in\/blog\/2024\/12\/25\/shell-script-to-check-number-is-palindrome\/","title":{"rendered":"Shell script to check number is Palindrome"},"content":{"rendered":"\n<p>Unix Shell script to check number is Palindrome <\/p>\n\n\n\n<p><strong>For Number :<\/strong><\/p>\n\n\n\n<p>echo &#8220;Enter a number to find for palindrome&#8221;<br>read num1<br>num=$num1<br>i=0<\/p>\n\n\n\n<p>while [ $num -gt 0 ]<br>do<br>let i=i*10+num%10 # Using let for arithmetic operations<br>let num=num\/10<br>done<\/p>\n\n\n\n<p>if [ $i -eq $num1 ] ; then<br>echo &#8220;$num1 is a palindrome&#8221;<br>else<br>echo &#8220;$num1 is not a palindrome&#8221;<br>fi<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>For String :<\/strong><\/p>\n\n\n\n<p>echo &#8220;enter a string&#8221;<br>read str<\/p>\n\n\n\n<p>var1=<code>echo \"$str\" | rev<\/code><br>if [ &#8220;$var1&#8221; != &#8220;$str&#8221; ] ; then<br>echo &#8220;no pali&#8221;<br>else<br>echo &#8220;pali&#8221;<br>fi<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unix Shell script to check number is Palindrome For Number : echo &#8220;Enter a number to find for palindrome&#8221;read num1num=$num1i=0 while [ $num -gt 0 ]dolet i=i*10+num%10 # Using let for arithmetic operationslet num=num\/10done if [ $i -eq $num1 ] ; thenecho &#8220;$num1 is a palindrome&#8221;elseecho &#8220;$num1 is not a palindrome&#8221;fi For String : echo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":43,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,14],"tags":[16,15],"class_list":["post-88","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bca","category-unix-shell-programming","tag-shell-script","tag-unix-shell-programming"],"_links":{"self":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":1,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/88\/revisions\/89"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/media\/43"}],"wp:attachment":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}