Write a shell script to accept the string and checks whether the string is palindrome or not.
clear
echo "Enter String : \c"
read str
len=`echo $str|wc -c`
len=`expr $len - 1`
echo "length of String : "$len
i=1
while [ $i -le $len ]
do
revstr=`echo $str|cut -c$i`$revstr
i=`expr $i + 1`
done
if [ "$revstr" = "$str" ]
then
echo "Your string is palindrome"
else
echo "Your string is not palindrome"
fi
echo "Enter String : \c"
read str
len=`echo $str|wc -c`
len=`expr $len - 1`
echo "length of String : "$len
i=1
while [ $i -le $len ]
do
revstr=`echo $str|cut -c$i`$revstr
i=`expr $i + 1`
done
if [ "$revstr" = "$str" ]
then
echo "Your string is palindrome"
else
echo "Your string is not palindrome"
fi
Labels:
shell script
Subscribe to:
Post Comments (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Blog Archive
-
▼
2012
(79)
-
▼
August
(9)
- Write a script to copy the file system from two di...
- Write a shell script to broadcast a message to a s...
- Write a shell script to find the global complete p...
- write a shell script to fetch the data from a file...
- Write a shell script to accept filename and displa...
- Accept strings and replace a string by another string
- Write a shell script to Accept number and check th...
- Write a shell script to accept the string and chec...
- Write a shell script to accept numbers and perform...
-
▼
August
(9)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.
0 comments:
Post a Comment