|
|
|
|
|
by andreyv
1627 days ago
|
|
> So there is no way to abort a bash script if something like <(sort nonexistent) fails. The process ID of the last executed background command in Bash is available as $!. cat <(sort nonexistent)
wait $! || echo fail
gives sort: cannot read: nonexistent: No such file or directory
fail
|
|
After a quick search it doesn't seem like this is an option for anything but the last executed background process. So if you have the typical `diff <(left) <(right)`, there is no easy way to get the pid of `<(left)`.
I suppose you could output the pid to a file, and use it from there, though I haven't tested if that would work.