yash-rs icon indicating copy to clipboard operation
yash-rs copied to clipboard

Tilde expansion in switch word in assignment

Open magicant opened this issue 4 years ago • 0 comments
trafficstars

Should tildes in a=${b-~:~} be parsed as tilde expansions or literal characters? Existing shells seem disagree.

$ shells -c 'HOME=HOME; a=${b-~:~}; echo "$a"'
==> bash <==
HOME:HOME

==> bash --posix <==
HOME:~

==> dash <==
HOME:HOME

==> ksh <==
HOME:~

==> mksh <==
HOME:HOME

==> mksh -o posix <==
HOME:HOME

==> mksh -o sh <==
HOME:HOME

==> yash <==
~:~

==> yash -o posix <==
~:~

==> zsh <==
HOME:HOME

==> zsh --emulate sh <==
~:~

==> zsh --emulate ksh <==
~:~

magicant avatar Jun 05 '21 02:06 magicant