How many 5 letter palindromes are there in datafile? 
[An example of a palindrome are the words radar, madam, level]

grep -ic '^\([a-z]\)\([a-z]\)[a-z]\2\1$' datafile
grep -c '^\([a-zA-Z]\)\([a-zA-Z]\)[a-zA-Z]\2\1$' datafile
grep –c '^\([[:alpha:]]\)\([[:alpha:]]\)[[:alpha:]]\2\1$' datafile

---------------------------------------------------- 2

#! /bin/sh
# palindrome finder; takes input from keyboard

case "${1}" in
  *-*)  BEGIN=${1%-*}; END=${1#*-} ;;
   ?*)  BEGIN=${1}; END=$BEGIN ;;
    *)  BEGIN=2; END=19 ;;
esac

tr -cs '[:alpha:]' '[\n*]' |
while read word ;do
  if [ ${#word} -lt $BEGIN ] || [ ${#word} -gt $END ] ;then
    continue
  fi
  tmp=$word
  while [ ${#tmp} -gt 1 ] ;do
    [ ${tmp#${tmp%?}} = ${tmp%${tmp#?}} ] || continue 2
    tmp=${tmp%?}
    tmp=${tmp#?}
  done
  echo "Palindrome: " $word
done

----------------------------------------------------- 3

#! /bin/bash
# palindrome finder; input from keyboard

awk 'BEGIN {
  split(ARGV[1],a,"-")
  if (!a[1]) a[1]=2
  if (!a[2]) a[2]=19
  FS="[^[:alpha:]]+"
  ARGC=1
}
{
  for (n=0; ++n<=NF;) {
    len=length($n)
    if (lena[2]) continue
    p=1
    for (i=int(len/2); p && i; --i)
      p = (p && (substr($n,i,1) == substr($n,len-i+1,1)))
    if (p) print "palindrome: "$n
  }
}'


------------------------------------------------------ 4

l=0
cnt=1
tag=0
echo "Enter a String?"
read str

l=`echo $str | wc -c`
l=`expr $l - 1`
lh=`expr $l / 2`

while [ $cnt -le $lh ]
do
   c1=`echo $str | cut -c $cnt`
   c2=`echo $str | cut -c $l`

     if [ $c1 != $c2 ] ; then
        cnt=$lh
        tag=1
     fi

   cnt=`expr $cnt + 1`
   l=`expr $l - 1`
done


if [ $tag -eq 0 ] ; then
   echo "String is Palindrome"
else
   echo String is not Palindrome
fi

#http://www.mit.jyu.fi/opiskelu/kurssit/unixshell01/demo4mallit.html

    Source: geocities.com/pageclasses