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

Re: treatment of empty strings - why is this not a bug?



>>>>> Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> writes:

> It's not a bug because it's documented to do something incredibly
> pointless:

If the reason for this behavior is incredibly pointless, should there
be a shell option to change the default to the more reasonable thing?

>   For historical reasons, the usual behaviour that empty array elements
>   are retained inside double quotes is disabled for arrays generated
>   by splitting; hence the following:

I still do not understand why I get exactly two empty strings no
matter how many colons I have in the input string: I would expect
none based on the description you cited.

phl% x=::::: && for v in "${(s-:-)x}" ; do echo "v= =>$v<=" ; done
v= =><=
v= =><=
phl% x=: && for v in "${(s-:-)x}" ; do echo "v= =>$v<=" ; done 
v= =><=
v= =><=

thanks,
Greg



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