Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Array values and parameter expansion specs
- X-seq: zsh-workers 1750
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Array values and parameter expansion specs
- Date: Tue, 23 Jul 1996 18:52:06 -0700
- Reply-to: schaefer@xxxxxxx
There isn't much documentation in zshexpn.man concerning which of the SPEC
forms can be used with array expressions. For example, ${#NAME} describes
what happens if NAME is an array, and there are a few mentions of NAME[@],
but otherwise there's silence. The stuff in zshparam.man (and the "Array
parameters" section of zsh.info) is no more helpful.
Consider:
zsh% foo=(1 2 3)
zsh% echo ${foo[2]:+whee}
whee
zsh% echo ${foo[2]:-whee}
2
zsh% echo ${foo[2]:=whee}
zsh: closing brace expected
zsh%
What's the distinction?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author