bug-bash
[Top][All Lists]
Advanced

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

Re: Checking executability for asynchronous commands


From: Léa Gris
Subject: Re: Checking executability for asynchronous commands
Date: Mon, 28 Dec 2020 22:45:20 +0100
User-agent: Telnet/1.0 [tlh] (PDP11/DEC)

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

[Prev in Thread] Current Thread [Next in Thread]