echo do not print NUL byte

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



there is no way to print the NUL byte with the echo utility

with an XSI shell (mksh, posh, yash):

  $ sh -c 'echo \\0 | od -An -c'
    \0  \n

with a shell that requires echo -e (ksh, bash, busybox, mksh):

  $ sh -c 'echo -e \\0 | od -An -c'
    \0  \n

with dash (XSI, no -e argument):

  $ dash -c 'echo \\0 | od -An -c'
    \n

where others characters are correctly printed:

  $ dash -c 'echo \\0100 | od -An -c'
     @  \n

with dash it only works with printf:

  $ dash -c 'printf \\0\\n | od -An -c'
    \0  \n


I discovered this bug developing a small shell library, where you can
find an use case in the n_bytes_encode function of the lib/bytes.sh file
included in http://www.trek.eu.org/devel/naive/naive-0.0.2.tar.gz

c-ya!
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux