[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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

On Fri, Aug 17, 2018 at 03:43:58PM +0200, tomas@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 closed, or if it's redirected to a file that
can't be written to (because of a full disk, etc.).

Sure, it may work 99.99% of the time, but it's still not safe.

Reply to: