3 ms·
Hack: long-running-command & pid_of_long_running_cmd=$(pidof long-running-command) tail --pid=$pid_pf_long_running_cmd -f /dev/null && forgotten-co
by not_your_vase 10mo ago
Hack:
long-running-command &
pid_of_long_running_cmd=$(pidof long-running-command)
tail --pid=$pid_pf_long_running_cmd -f /dev/null && forgotten-command
Tail quits when $pid_pf_long_running_cmd disappears, and kicks off the forgotten-command. (It won't know however the exit code of the original cmd, so that's a drawback)
- baobun 10mo agoYeah, the problem here is it requires preparation and preemptively adding that '&' to the first command. It doesn't work for the "oh, right" situations. Running all commands this way by default wouldn't make life easier. But along those lines yeah, it's basically the same as the "wait for it in another terminal" approach and I guess a solution would contain something similar.