-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Craig Sanders on 6/27/2009 7:20 PM: > please add a -0 option to tr, which is equivalent to > running: > > tr '\n' '\000'
Why should we burn an option letter, when it is not that much more typing to get what you wanted anyways? An option letter makes the most sense only when there is no other easy way to do the same task. > this is a useful command for converting \n-terminated input lines to > null-terminated strings suitable for feeding into 'xargs -0' as many > programs can not generate null-terminated ouput by themselves. This proposal doesn't really buy you anything. Either the output is already nul-terminated (in which case you don't need an extra tr process in the mix), or it is newline terminated (in which case you should just use plain xargs instead of 'xargs -0', and you already have to worry about the potential for filenames with embedded newlines). In short, throwing tr in the mix just to convert newlines to nul bytes does not buy you any security. > it would also be useful if tr did this automatically if invoked > as 'print0'. GNU Coding Standards discourage programs that change their behavior based on how argv[0] was spelled. But there is no need to change tr, when you can easily do this yourself: $ cat <<\EOF >>/usr/local/bin/print0 #!/bin/sh exec tr '\n' '\0' EOF $ chmod +x /usr/local/bin/print0 - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkpG4tgACgkQ84KuGfSFAYCqigCfe0uj9ulITy+i+kcVxwxah2f3 wUMAnRRvagxC43sko/y3Lo4izEMIYxdf =BuUY -----END PGP SIGNATURE----- _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils