#761621 bash: cannot echo $'\x00'

Package:
bash
Source:
bash
Description:
GNU Bourne Again SHell
Submitter:
era eriksson
Date:
2014-09-15 06:09:10 UTC
Severity:
wishlist
#761621#5
Date:
2014-09-15 06:07:33 UTC
From:
To:
I was somewhat surprised and miffed to find that this does not work.

I found old correspondence about this issue on the bash-bugs mailing
list [1] but it was hardly an exhaustive discussion.

[1]: http://lists.gnu.org/archive/html/bug-bash/2006-03/msg00063.html

To my mind, in particular the non-POSIX $'\x00' syntax could impossibly
be used in scripts which do not run Bash. It's not entirely clear to me
what the logic should be here; if the builtin echo really cannot support
this, then perhaps a warning message would be appropriate.

As noted in the 2006 discussion, a (portable!) workaround is to use
printf instead.