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 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,
Could it be that the reason this does not work from the shell prompt as I expect, is perhaps that my command prompt is successfully running a command in between, and therefore hiding all error codes?