address@hidden (Bob Proulx) wrote:
> Paul Jarc wrote:
>> false --help exits 0. false --version exits 1. I think false --help
>> should be changed, but certainly one of them should be.
>
> Hmm... I think all commands with --version should exit 0 for
> consistency.
I think false should exit nonzero regardless of its arguments, for
consistency.
> However bash's shell built-in false has the same exit 1 behavior.
Yes, for both --help and --version. I just checked the external false
command on Solaris, NetBSD, and FreeBSD, and the built-in in pdksh;
they don't recognize --help and --version, so they exit nonzero.
coreutils' false is definitely in the minority.
> Is there really a reason to stir up this nest of hornets?
The case where it makes a difference is when a program dynamically
constructs a command line: at one point, it sets the command name to
"false", expecting that will make the command exit nonzero; at another
point, it sets the first argument to "--help", possibly expecting that
will make the command a successful no-op. This is probably extremely
uncommon, but uniformity can't hurt.
> Perhaps there is only 'true' and '! true' after all. :-)
Not even; ! isn't portable, according to the autoconf manual.
paul