Line 2:
while pgrep $1 >/dev/null; do sleep 2; done && $*
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2048: Use "$@" (with quotes) to prevent whitespace problems.
Also, how do you pick the right job to wait for if several programs match $1? (E.g. if it's a bash script, $1 will be "bash", which on my system matches lots of things.)
Also, a 2s sleep will slow things down if you want to use it for a whole lot of jobs.
Also, this won't run your second command if the first command you wait for has already exited!
Also, shouldn't $* be `shift; "$@"` or do you only ever queue jobs of the same command?
unhammer|5 years ago
Also, a 2s sleep will slow things down if you want to use it for a whole lot of jobs.
Also, this won't run your second command if the first command you wait for has already exited!
Also, shouldn't $* be `shift; "$@"` or do you only ever queue jobs of the same command?
xtf|5 years ago