Aagam it looks like there's something funny going on with your shell. What's the output of these commands?
ls -l /bin/sh
Did you try running these scripts as a different user? From a different terminal emulator, or a regular tty? Or maybe reinstalling bash? If nothing works, try running the scripts using a Live CD.
and plz tell me the command used to extract a letter from the string by specifying its position...
let's say that
To print the first (position zero) letter (A):
So, you give the name of the variable, the position starting from zero, and the number of letters.