On 07/27/2017 07:23 AM, Bosco wrote: > According the man pages, Which man pages? Echo is one of those programs that varies widely, and you are MUCH better off using printf(1) instead of echo(1) if you are trying to get newline suppression, trying to print something that might begin with -, or trying to print something that might contain \. > for echo command, "\\" should print '\' > character, and \0digits should print the byte in octal base. > But the command > > echo "\\1" This is the same as echo '\1' which is NOT defined by POSIX as being a valid escape sequence that echo must recognize. (Did you mean to test echo '\\1' instead?) Here's the POSIX list of required escape sequences: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html > > outputs the byte 0x01 in hexadecimal (or 001 in octal). > Is this a bad behavior or is intentional? Arguably, since it is not required by POSIX, we don't have to do it. But I also can't argue that POSIX forbids us to support \1 as an extension (it says nothing about whether implementations can have additional escape sequences). So I'll argue that it is intentional as a dash extension. But if you can make dash smaller by getting rid of the extension, that might be an acceptable patch. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org