title: Bad substitution error in ksh
body: <p>The following KornShell (ksh) script should check if the string is a palindrome.  I am using <code>ksh88</code>, not <code>ksh93</code>.</p>
  
  <pre><code>#!/bin/ksh
  strtochk="naman"
  ispalindrome="true"
  len=${#strtochk}
  i=0
  j=$((${#strtochk} - 1))
  halflen=$len/2
  print $halflen
  while ((i &lt; $halflen))
  do
   if [[ ${strtochk:i:1} == ${strtochk:j:1} ]];then
         (i++)
         (j--)
   else
    ispalindrome="false"
    break
   fi
  done
  
  print  ispalindrome
  </code></pre>
  
  <p>But I am getting bad substitution error at the following line : <code>if [[ ${strtochk:i:1} == ${strtochk:j:1} ]];then</code></p>
  
  <p>Can someone please let me know what I am doing wrong?</p>