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

Re: [bug] sh: tilde expansion after field splitting



Op 08-10-17 om 09:53 schreef Bart Schaefer:
> On Oct 5, 12:20am, Martijn Dekker wrote:
> } Subject: [bug] sh: tilde expansion after field splitting
> }
> } POSIX says tilde expansion should be done before parameter expansion [...]
> } zsh did this correctly up to version 5.0.8; as of 5.1, it appears to do
> } tilde expansion *after* field splitting, and only from the second field on.
> 
> The patch below fixes this, I believe.  Several comments:

This introduces a bug with "$@", $@ and $* expansion:

$ Src/zsh -o SHFILEEXPANSION -c 'set "a" "b"; printf "[%s]\n" "$@$@"'
[a]
[b$@]

$ Src/zsh -o SHFILEEXPANSION -c 'set "a" "b"; printf "[%s]\n" $@$@'
[a]
[b$@]

$ zsh -o SHFILEEXPANSION -c 'set "a" "b"; printf "[%s]\n" $*$*'
zsh:1: no matches found: b$*

Expected output for all three:
[a]
[ba]
[b]

Thanks,

- M.



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