On 28/12/2020 at 21:18, Eli Schwartz wrote:
if cmd=$(type -P foo) && test -x "$foo"; then
     foo &
else
     echo "error: foo could not be found or is not executable"
fi

When you handle such logic within Bash you already lost on a race condition when foo is readable and executable when you test it, but when it reaches the actual execution, it is no longer the case.

Bash is full of race conditions, because bash was never meant as a General Purpose language. Bash is a good command sequencer.

Now if ppl forget to use wait PID after launching a sub-shell background command, then shame on them.

--
Léa Gris


Reply via email to