Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is this a side effect of RC_EXPAND_PARAM?
- X-seq: zsh-users 9748
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Is this a side effect of RC_EXPAND_PARAM?
- Date: Sun, 04 Dec 2005 00:16:16 +0000
- In-reply-to: <20051202210456.GA821@DervishD>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20051202210456.GA821@DervishD>
On Dec 2, 10:04pm, DervishD wrote:
}
} What am I doing wrong? Is this a bug or a feature?
zagzig% var="one|two||four|five"
zagzig% print -l "${(s:|:)var}"
one
two
four
five
zagzig% setopt rcexpandparam
zagzig% print -l "${(s:|:)var}"
one
two
four
five
zagzig%
With rcexpandparam the empty element is retained so that it can be joined
with whatever appears on both sides of the expansion (even though in this
case that's nothing) so you get the equivalent of
vara=("one" "two" "" "four" "five")
whereas with it NOT set, the empty element is removed, so you get
vara=(one two four five)
Forcing empty elements to be retained as empty rather than removed is
one reason the compsys functions have rcexpandparam set. Admittedly
this ought to be documented, rather than assuming that anyone who sets
rcexpandparam must be familiar with the semantics of the rc shell ...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author