Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why are empty elements removed from array expansion?



On Thu, Dec 23, 2010 at 08:09, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Dec 22, Â9:46pm, Nikolai Weibull wrote:

> } Subject: Why are empty elements removed from array expansion?

> This is thus a "principle of least surprise" issue -- not what least
> surprises *you*, as a programmer expecting certain rigid rules, but
> what least surprises an inexpert shell user trying to figure out why
> "cat $a" says that the empty string can't be opened as a file.

Itâs sad that I have to pay the tax for such users.

Is this the same reasoning behind the fact that empty string variables
are removed as arguments as well?

% a=
% print -l $a $a

% print -l "$a" "$a"


%

This is, speaking as a programmer, perhaps even worse.

Thank you for your explanation.



Messages sorted by: Reverse Date, Date, Thread, Author