Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

ksX-Mailer: MH-E 8.6; GNU Mailutils 3.2; GNU Emacs 24.5.1




I wanted to use the array flage (i) to get an index into a charagcter array (a string), but am getting incorrect results.  Here is an example code snippet which shows the  oddity.

#
#  below define a table (string) with 4 characters.
chrtab="#()*"
for (( ndx=1;  ndx<=$#chrtab ; ndx++ ))
    do echo "Character is $chrtab[ndx], but retrieved index is $chrtab[(i)$chrtab[ndx]]"
    done

I expect the result to be 1, 2, 3, 4
                 but get  5, 5, 5, 1

Is this a a feature or a bug?




Messages sorted by: Reverse Date, Date, Thread, Author