This has been discussed at the Austin Group (POSIX fixing/development)
recently, but no definitive interpretation has been issued yet. The
current standard is rather vague to allow various implementations to
comply.

I agree that bash's behaviour is better here, but it is possible that
the interpretation will be such that dash's behaviour is also compliant.

In other cases such as echo "${foo+'ab}", I think bash interpreted the
current standard incorrectly (it requires matching quotes, but if you
give "${foo+'ab'}" it does not remove them), while dash has more
sensible behaviour. In both cases, ksh93 (the real Korn shell from AT&T,
probably packaged as "ksh") behaves sensibly, by distinguishing between
+-=? and #% expansions.

Workarounds for this are to put the expansion in a lone assignment (so
it does not need double-quotes around it) or otherwise add indirection
through variables (e.g. q=\' then use $q instead of a single-quote).

-- 
Dash remove prefix expansion (${a#b}) doesn't work in double quotes
https://bugs.launchpad.net/bugs/239561
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to