Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: treatment of empty strings - why is this not a bug?
- X-seq: zsh-workers 26330
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: treatment of empty strings - why is this not a bug?
- Date: Fri, 16 Jan 2009 19:35:27 -0800
- In-reply-to: <m38wpbw3v2.fsf@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <18796.17298.94642.461735@xxxxxxxxxxxxxxxxxx> <090115201912.ZM20275@xxxxxxxxxxxxxxxxxxxxxx> <m38wpbw3v2.fsf@xxxxxxxxxxxxxx>
On Jan 16, 12:35pm, Greg Klanderman wrote:
}
} I don't understand how empty strings get into arrays unless one
} explicitly puts them there..
Consider an array populated by using a glob pattern, which is then
subjected to replacement using $arr:s/pat// or $arr:h or $arr:t.
You don't know at time of execution what will be matched in by the
glob, nor necessarily what will be left behind after substitution.
If the substitution results in an emtpy string, how often do you
want that to remain in the argument list of whatever action you next
apply to the contents of the array?
If what you're attempting to do is transform one set of file names
into another, which is the most common operation at the shell command
line if not in scripts, I'd argue that generally you do not. On the
other hand, if the file name contains spaces, you don't want it to be
split.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author