Home
|
Ask Question
|
Interview Questions
|
Tech FAQ
s
|
Engineering
|
Company
|
Geek Forums
|
Interview Coaching
|
Online Quiz
|
Interview eBook
Code Base
Submit Code
Back
Oracle
PHP
Java
ASP.NET
C#
Delphi
VB.NET
Perl
ColdFusion
SQL Server
MySQL
C
C++
UNIX
AJAX
Flash
HTML
CSS
Java Script
VB Script
XML
Python
MS Access
MainFrame
UNIX Code Base
•
File Retriever
•
Mail Checker
•
UNIX Shell Program To Find Palindrome
Code Samples
UNIX
UNIX Shell Program To Find Palindrome
Code Resource
Author:
mano.mithun
Difficulty Level
: Beginner
Published:
3rd Aug 2010
Read:
6750 times
Filed in:
UNIX
Add Comment
Sponsored Links
To find a palindrome of a number using shell programming!
Sample Code
echo
"String please :"
read str
len=`expr $str
|
wc -c`
len=`expr $len -
1
`
mid=`expr $len
/
2
`
flag=
1
m=
1
while
[
$m -
le
$mid
]
do
c=`echo $str
|
cut -c$len`
p=`echo $str
|
cut -c$m`
if
[
$c
!
= $p
]
then
flag=
0
break
fi
m=`expr $m +
1
`
len=`expr $len -
1
`
done
if
[
$flag -
eq
1
]
then
echo
"The string is palindrome"
else
echo
"The string is not palindrome"
fi
Copyright GeekInterview.com
Next Article:
File Retriever
Latest Code Samples
♦
UNIX Shell Program To Find Palindrome
♦
File Retriever
♦
Mail Checker
Popular Code Samples
♦
UNIX Shell Program To Find Palindrome
♦
File Retriever
♦
Mail Checker
Related Code Samples
»
Program to print asterisk(*) pattern in C++
»
Find MAC Address
»
Find Number of Files and Sub Directories
»
Program to find out an adam number using arrays
»
C Program to change the case of a string
»
C Program to get Marks Card Details
»
Oracle Database Cold backup Unix
»
SQL to Find Experience of an Employee
»
A Simple java program to learn JTabbed
»
Find your day from your DOB
Post Your Comment:
Members Please Login
Your Name:
*
e-mail ID:
(required for notification)
*
Image Verification:
Subscribe
Popular Coders
#
Coder Name
Hits
1.
mano.mithun
6751
2.
christia
3583
3.
GregMark
2948
Active Coders
#
Coder Name
Codes
1.
GregMark
1
2.
christia
1
3.
mano.mithun
1
Refined Tags
Copyright © 2012 GeekInterview.com | All Rights Reserved