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

Re: ${^var} and word splitting



2014-11-24 23:49:31 -0800, Bart Schaefer:
[...]
> } ~$ a=' a  b ' zsh -c 'print -l ${(s, ,)a}'
> } a
> } b
> } ~$ a=' a  b ' zsh -c 'print -l "${(s, ,)a}"'
> } 
> } a
> } b
> } 
> } ~$ a=' a  b ' zsh -c 'print -l "${(s, ,@)a}"'
> } 
> } a
> } 
> } b
> } 
> } ~$
> } 
> } I'd rather 2 above behave either like 1 or [3].
[...]
> } It may be too late to change the behaviour now, though I'd find
> } it hard to imagine people relying on "$=var" to make empty
> } arguments at the beginning and end but not in the middle.
> 
> I have the nagging suspicion there may be cases in the completion code
> that expect exactly that ... or that have been programmed to work around
> it and would need to be fixed if it changes.
[...]

I'd be surprised if it were the case.

Anyway, if one wants 1, he can write it as 1, and if one wants
3, he can write it as 3.

So, that's no big deal if 2 stays the way it is. It's just that
I don't find it intuitive or /consistent/.

2 is specific to zsh anyway. Other shells don't split inside
double quotes (except for ${array[@]}) and $^a is zsh-specific.

So it's not a question of compatibility with other shells.
zsh -o shwordsplit works like other shells where the behaviour
is defined in other shells.

-- 
Stephane



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