Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Associative array, brace-free subscripting: key with spaces
- X-seq: zsh-users 20855
- From: Clint Hepner <clint.hepner@xxxxxxxxx>
- To: "<zsh-users@xxxxxxx>" <zsh-users@xxxxxxx>
- Subject: Associative array, brace-free subscripting: key with spaces
- Date: Thu, 29 Oct 2015 13:17:17 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=21X6VYbSg4fLMpYAAavdonwj4MMqSZCOiOguNt0wZ5c=; b=x9ym2sPPvaC6Ioy5CiJzQ3Xuu3jPmzs5E3auUl4XcT8LJyHL2DUry6MkmmcvRFiJcA tlKe/I18TWXNfts78pZC4+hhggwNYvn78tkKfLGlHujC7RPJRvt2hAT0wFhjbsxDtBW6 KFquxMtWqFzDbTEyYfLUAqSrnFn9TFKtexgTQC/IGI3KVFU5Yrd4GEG8ZZwaYxDseW67 puZqGgTmuy3GejwUE5PRLaCtF4HnS9HvqzUidWwbk8dIUkzImkbfu49fPpP88+Fj4SHJ 9SxUFwIUfgKjegRAXXy/TC+TYToKSNUPYRE+zlMONPjvDLVWzb/IulF2ETwwf3YOGM+P 1kfw==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Consider the array
typeset -A b
b=("a b c" d)
The following correctly expands to "d"
${b[a b c]}
but this results in a "bad subscript" error:
$b[a b c]
I can't seem to find anything in the man page about why this would
be the case. It seems to be a parsing error, since using a separate
parameter to store the key works fine as well:
z="a b c"
print $b[$z]
--
Clint Hepner
clint.hepner@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author