zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Re: PATCH: small parameter fix
Date: Mon, 08 Mar 1999 16:55:08 +0100	[thread overview]
Message-ID: <9903081555.AA18627@ibmth.df.unipi.it> (raw)
In-Reply-To: "Bart Schaefer"'s message of "Mon, 08 Mar 1999 01:01:01 NFT." <14051.37325.463850.598816@localhost.localdomain>

>  > 
>  >   ${${...}[...]}
>  > 
>  > previously didn't really work: if the inner ${...} produced an array
>  > with only one element, the outer ${...} treated it as a string and the 
>  > subscript gave the n'th character.
> 
> AHA!  This must be the reason that "${${(@)...}...}" is required in so
> many mystifying circumstances.  I, too, would like to hear whether the
> previous behavior was intentional ... this change does potentially
> break scripts, including I think 3.0.5 scripts, so we'd better tread
> carefully.

in particular it has this effect:

% print "${$(uname -n)[1]}"
ibmth

where you might guess $(...) in quotes produced a scalar for subscripting
--- indeed it did, but the subscripting decided to treat it as an array
element.  In fact, since the nested substitution recognises the quotes
whereas the subscripting doesn't, you get,

% print "${${path}[1]}"
/home/user2/pws/bin /home/user2/pws/links /home/user2/pws/mh/bin
/home/user2/pws/scripts /usr/local/bin /usr/sue/bin /usr/bin /usr/bin/X11
/usr/ucb /usr/local/bin/X11 /cern/pro/bin /usr/local/cap /etc .

(wrapped a bit --- well, you don't get that, but I do) which is distinctly
on the strange side.  I would suggest that in quotes the old behaviour
character-subscripting behaviour is the right one.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-03-08 16:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-08  8:50 Sven Wischnowsky
1999-03-08  9:01 ` Bart Schaefer
1999-03-08 15:55   ` Peter Stephenson [this message]
1999-03-09  8:16     ` Andrej Borsenkow
1999-03-09  8:19 Sven Wischnowsky
1999-03-09 10:12 Sven Wischnowsky
1999-03-09 10:30 Sven Wischnowsky

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=9903081555.AA18627@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).