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

tilde expansion after quoted : in assignments



2021-04-30 07:51:23 +0100, Stephane Chazelas:
[...]
> BTW, zsh is the only shell where ~ is expanded in:
> 
> $ zsh -c 'a=a\:~; echo $a'
> a:/home/chazelas
[...]

That's a POSIX non-conformance btw:

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html#tag_18_06_01

Tilde expansion is only meant to be done after unquoted : per
POSIX. Though I can't imagine being a problem in practice. If
people don't want tilde expansion, they'd quote the ~, not the
:.

Also, there's a lot of variation between shells in how tilde
expansion is done and the specification is quite vague there.

See also ~$user or ~"user" or var=foo$COLON~ or var=foo${-+:}~
...

See also https://www.austingroupbugs.net/view.php?id=1172
(I had completely forgotten I'd raised that).

-- 
Stephane




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