read s t=$s set `seq ${#s}` for i;{ printf "$t${s:i-1:1} ${s:$#-i:1}" t=%$[$#-1]s } rev<<<$s