-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thu, Aug 23, 2018 at 02:59:18PM +0200, Stefan Krusche wrote:
[...]
> Nothing. What Tomás wrote is false (has exit code "1" ;-)
>
> This:
>
> test $? && echo ok || echo error $?
>
> does *not* expand as Tomás said to:
>
> test 0 && echo ok
Am Freitag 17 August 2018 schrieb Zenaan Harkness:
> On Fri, Aug 17, 2018 at 11:25:52AM +0200, to...@tuxteam.de wrote:
> > On Fri, Aug 17, 2018 at 06:46:54PM +1000, Zenaan Harkness wrote:
> > > 1)
> > > Bash man page largely fails to document the true and false builtins
> > > AFAICT, except for
On Fri, Aug 17, 2018 at 08:23:51AM -0400, Greg Wooledge wrote:
> Simply use "if" like you're supposed to.
Sometimes the simple things in bash are free. Or something :)
Thank you so much Greg - I really appreciate this - this was the
answer I didn't know I wanted until you named it.
Kind
On Fri, Aug 17, 2018 at 04:36:43PM +0200, to...@tuxteam.de wrote:
> On Fri, Aug 17, 2018 at 10:12:54AM -0400, Greg Wooledge wrote:
> > On Fri, Aug 17, 2018 at 03:43:58PM +0200, to...@tuxteam.de wrote:
> > > The construction
> > >
> > > foo && echo "bar" || echo "baz"
> > >
> > > does probably
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 10:12:54AM -0400, Greg Wooledge wrote:
> On Fri, Aug 17, 2018 at 03:43:58PM +0200, to...@tuxteam.de wrote:
> > The construction
> >
> > foo && echo "bar" || echo "baz"
> >
> > does probably work, because echo's exit status
On Fri, Aug 17, 2018 at 03:43:58PM +0200, to...@tuxteam.de wrote:
> The construction
>
> foo && echo "bar" || echo "baz"
>
> does probably work, because echo's exit status is (always?) 0 (the bash
> builtin's documentation mumbles something about "write error").
echo can fail if stdout is
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 08:23:51AM -0400, Greg Wooledge wrote:
> On Fri, Aug 17, 2018 at 06:46:54PM +1000, Zenaan Harkness wrote:
> > $ test $? && echo ok || echo error $?
>
> Others have already pointed out that test $? is not what you think it
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 12:34:38PM +0100, Clive Standbridge wrote:
[...]
> > $ false
> > $ test $? && echo ok || echo error $?
>
> The second $? in that line is different from the first; it's the exit
> status of "test". That can be demonstrated,
On Fri, Aug 17, 2018 at 06:46:54PM +1000, Zenaan Harkness wrote:
> $ test $? && echo ok || echo error $?
Others have already pointed out that test $? is not what you think it
is. When the test command is given 1 argument, it tests that argument's
string length. If the string length is 0, then
> Is there a "cleaner" way to test the true/ error exit status other
> than using "$?", with bonus points for working in posix sh as well as
> Bash, ?
test $? -eq 0
"help test" will tell you more.
Another point from your original mail,
> $ false
> $ test $? && echo ok || echo error $?
The
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 07:29:47PM +1000, Zenaan Harkness wrote:
> On Fri, Aug 17, 2018 at 10:51:03AM +0200, Nicolas George wrote:
> > Zenaan Harkness (2018-08-17):
> > > But whilst the subsequent list of Bash builtin commands DOES include
> > >
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 11:42:56AM +0200, to...@tuxteam.de wrote:
[...]
> Few surviving languages have that kind of evaluation model (the shells,
> Tcl -- and in a very interesting twist the Lisps). Powerful, but
> sometimes confusing.
And (oh,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 07:32:39PM +1000, Zenaan Harkness wrote:
[...]
> That accords with my previous understanding, that the exist status of
> running false gives something other than "success" (i.e. zero) - what
> am I missing?
The next step:
Zenaan Harkness (2018-08-17):
> Aha. It's actually the Special Parameter "?", aka "$?" that I did not
> understand - I was treating it as a value, when actually it is
> something that expands, i.e. into a string, and not something that is
> treated as true or false.
That is how all parameters
On Fri, Aug 17, 2018 at 11:25:52AM +0200, to...@tuxteam.de wrote:
> On Fri, Aug 17, 2018 at 06:46:54PM +1000, Zenaan Harkness wrote:
> > 1)
> > Bash man page largely fails to document the true and false builtins
> > AFAICT, except for this sentence just under the heading
> > "^SHELL BUILTIN
On Fri, Aug 17, 2018 at 10:51:03AM +0200, Nicolas George wrote:
> Zenaan Harkness (2018-08-17):
> > But whilst the subsequent list of Bash builtin commands DOES include
> > entries for ":" (the very first entry) and "test", it appears to fail
> > to include entries for "true" and for "false".
>
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Aug 17, 2018 at 06:46:54PM +1000, Zenaan Harkness wrote:
> 1)
> Bash man page largely fails to document the true and false builtins
> AFAICT, except for this sentence just under the heading
> "^SHELL BUILTIN COMMANDS":
>
> The :, true,
On Fri, Aug 17, 2018 at 10:51:03AM +0200, Nicolas George wrote:
> Zenaan Harkness (2018-08-17):
> > But whilst the subsequent list of Bash builtin commands DOES include
> > entries for ":" (the very first entry) and "test", it appears to fail
> > to include entries for "true" and for "false".
>
>
Zenaan Harkness (2018-08-17):
> But whilst the subsequent list of Bash builtin commands DOES include
> entries for ":" (the very first entry) and "test", it appears to fail
> to include entries for "true" and for "false".
Maybe because it does the same thing as the standard and non-builtin
true
On Fri, Aug 17, 2018 at 06:46:54PM +1000, Zenaan Harkness wrote:
> 1)
> Bash man page largely fails to document the true and false builtins
> AFAICT, except for this sentence just under the heading
> "^SHELL BUILTIN COMMANDS":
>
> The :, true, false, and test builtins do not accept options and
1)
Bash man page largely fails to document the true and false builtins
AFAICT, except for this sentence just under the heading
"^SHELL BUILTIN COMMANDS":
The :, true, false, and test builtins do not accept options and do
not treat -- specially.
But whilst the subsequent list of Bash builtin
21 matches
Mail list logo