Hello,
What do you think about adding a FAQ entry about confusing shell builtin
with coreutils' programs?
Will apply to echo,printf,test,[,kill.
Seems like common enough topic:
http://lists.gnu.org/archive/html/bug-coreutils/2013-03/msg00016.html
http://lists.gnu.org/archive/html/bug-coreutils/2013-05/msg00013.html
http://lists.gnu.org/archive/html/bug-coreutils/2014-05/msg00099.html
http://lists.gnu.org/archive/html/bug-coreutils/2015-08/msg00030.html
Something like this:
====
Q. echo/test/printf/test/[/kill do not work as documented.
Commonly, one of these doesn't work (yet expected to work):
echo --help
echo --version
echo -e '\x45'
printd --version
printf '\u263a\n'
kill --help
A. These commands are often implemented as shell builtin functions,
supporting less features than GNU coreutils' versions.
Use 'type' to determine if the command is a shell builtin:
$ type printf
printf is a shell builtin
versus:
$ type printf
printf is /usr/bin/printf
To use the external version of these programs, prefix with 'env' or
specify a full path.
shell builtin functions on do not support --version:
$ echo --version
--version
$ printf --version
bash: printf: --: invalid option
printf: usage: printf [-v var] format [arguments]
while GNU coreutils programs do support --version (and other features
mentioned in the documentation):
$ env echo --version | head -n1
echo (GNU coreutils) 8.21
$ env printf --version | head -n1
printf (GNU coreutils) 8.21
$ /bin/echo --version | head -n1
echo (GNU coreutils) 8.21
$ env echo -e '==\x3D=='
=====
$ env printf '\u263a\n'
[prints unicode smily face, if supported by your terminal]
These features often extends POSIX, and are not portable.
To restore strict POSIX compliance, use POSIXLY_CORRECT environment
variable as explained by Eric Blake:
http://lists.gnu.org/archive/html/bug-coreutils/2013-03/msg00016.html
====
regards,
- assaf