Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #198913

Bash true/false builtings undocumented? "false" not working?

From Zenaan Harkness <zenaan@freedbms.net>
Newsgroups linux.debian.user
Subject Bash true/false builtings undocumented? "false" not working?
Date 2018-08-17 10:50 +0200
Message-ID <wnICd-6jg-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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 commands DOES include
entries for ":" (the very first entry) and "test", it appears to fail
to include entries for "true" and for "false".

This would not matter so much except for the following:


2)
Why is executing "false" prior to testing it's output, apparently
differen to executing "false" in a pipeline, e.g.:

$ false
$ test $? && echo ok || echo error $?
ok
$ false blah
$ test $? && echo ok || echo error $?
ok
$ false --
$ test $? && echo ok || echo error $?
ok
$ true
$ test $? && echo ok || echo error $?
ok
$ true && echo ok || echo error $?
ok
$ false && echo ok || echo error $?
error 1
$ false blah && echo ok || echo error $?
error 1
$ false 2 && echo ok || echo error $?
error 1
$ false -- && echo ok || echo error $?
error 1
$ builtin false -- && echo ok || echo error $?
error 1
$ builtin false --
$ test $? && echo ok || echo error $?
ok
$ which false
/bin/false
$ /bin/false
$ test $? && echo ok || echo error $?
ok



The above results are perplexing me, and frustratingly
inconsistent!

For example, "man false" says inter alia:

NAME  false - do nothing, unsuccessfully
…
DESCRIPTION  Exit with a status code indicating failure.


The descriptions suggests that /bin/false ought work outside of a
pipeline in the same as way inside a pipeline - vhy, is, eet, not,
so?


TIA,

Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-17 10:50 +0200
  Re: Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-17 11:00 +0200
  Re: Bash true/false builtings undocumented? "false" not working? Nicolas George <george@nsup.org> - 2018-08-17 11:00 +0200
    Re: Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-17 11:30 +0200
    Re: Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-17 11:40 +0200
      Re: Bash true/false builtings undocumented? "false" not working? Nicolas George <george@nsup.org> - 2018-08-17 11:40 +0200
      Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-17 12:20 +0200
      Re: Re: Bash true/false builtings undocumented? "false" not working? Clive Standbridge <list-user@tgstandbridges.plus.com> - 2018-08-17 14:10 +0200
        Re: Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-17 15:40 +0200
      Re: Bash true/false builtings undocumented? "false" not working? Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-17 14:30 +0200
        Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-17 15:50 +0200
          Re: Bash true/false builtings undocumented? "false" not working? Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-17 16:20 +0200
            Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-17 16:40 +0200
              Re: Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-18 01:10 +0200
        Re: Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-18 01:30 +0200
  Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-17 11:30 +0200
    Re: Bash true/false builtings undocumented? "false" not working? Zenaan Harkness <zenaan@freedbms.net> - 2018-08-17 11:40 +0200
      Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-17 11:50 +0200
        Re: Bash true/false builtings undocumented? "false" not working? tomas@tuxteam.de - 2018-08-17 12:00 +0200
      Re: Bash true/false builtings undocumented? "false" not working? Stefan Krusche <linux@stefan-krusche.de> - 2018-08-23 15:00 +0200
        Re: Bash true/false builtings undocumented? "false" not working? <tomas@tuxteam.de> - 2018-08-23 16:30 +0200

csiph-web