zsh-users
 help / color / mirror / code / Atom feed
From: "jdh" <dhenman@gmail.com>
To: <zsh-users@zsh.org>
Subject: ksX-Mailer: MH-E 8.6; GNU Mailutils 3.2; GNU Emacs 24.5.1
Date: Sat, 09 Sep 2017 17:00:37 +1700	[thread overview]
Message-ID: <20170909170037.5276@sparky> (raw)



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?



             reply	other threads:[~2017-09-10  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09  0:00 jdh [this message]
2017-09-10  1:51 ` Phil Pennock
2017-09-10  5:08   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170909170037.5276@sparky \
    --to=dhenman@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).