From: Chris F.A. Johnson on
On 2010-06-12, Seebs wrote:
> On 2010-06-11, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
>> On 2010-06-11, Thomas 'PointedEars' Lahn wrote:
>>> The problem appears to be that you don't know about `--'.
>
>> Nor does echo.
>
> In his defense, I suspect that at least one person has created at least
> one version of "echo" which did. Trying to predict the possible ways
> in which someone somewhere has broken echo is hopeless.
>
> I am reasonably sure there has been at least one version of false which
> could be persuaded to print a version message and exit successfully,
> just because people really are that stupid. I'm quite sure that I've
> seen an implementation where "true --version" produced output on
> stdout or stderr... I believe it's since been fixed.

$ /bin/true --version
true (GNU coreutils) 7.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)

From: Tim Harig on
On 2010-06-12, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
> On 2010-06-12, Seebs wrote:
>> On 2010-06-11, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
>>> On 2010-06-11, Thomas 'PointedEars' Lahn wrote:
>>>> The problem appears to be that you don't know about `--'.
>>
>>> Nor does echo.
>>
>> In his defense, I suspect that at least one person has created at least
>> one version of "echo" which did. Trying to predict the possible ways
>> in which someone somewhere has broken echo is hopeless.
>>
>> I am reasonably sure there has been at least one version of false which
>> could be persuaded to print a version message and exit successfully,
>> just because people really are that stupid. I'm quite sure that I've
>> seen an implementation where "true --version" produced output on
>> stdout or stderr... I believe it's since been fixed.
>
> $ /bin/true --version
> true (GNU coreutils) 7.1
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.

You coreutils is a year old:

20:03,501$ /bin/true --version
true (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering.
From: Seebs on
On 2010-06-12, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
> $ /bin/true --version
> true (GNU coreutils) 7.1
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.

Ahh, but does "/bin/false --version" exit successfully, because it
successfully printed the version? :)

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Tim Harig on
On 2010-06-12, Seebs <usenet-nospam(a)seebs.net> wrote:
> On 2010-06-12, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
>> $ /bin/true --version
>> true (GNU coreutils) 7.1
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
>
> Ahh, but does "/bin/false --version" exit successfully, because it
> successfully printed the version? :)

22:25,501$ /bin/false --version
false (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering.

22:25,502,(1)$

Nope, returns 1.
From: News123 on

Seebs wrote:
> On 2010-06-12, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote:
>> $ /bin/true --version
>> true (GNU coreutils) 7.1
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
>
> Ahh, but does "/bin/false --version" exit successfully, because it
> successfully printed the version? :)
>
> -s

Why would you care????

i don't use --version in my scripts
and when I type
false --version, then I don't care for it's exit status.

You can always construct failing scenario, but I cannot imagine whenever
an exit code of 0 would have killed me or my scripts.