3 ms·
You can use Ctrl+z to suspend the foreground process, bg to resume it in the background, and then wait to wait for it to complete. By default wait will wait for
by i15e 10mo ago
You can use Ctrl+z to suspend the foreground process, bg to resume it in the background, and then wait to wait for it to complete. By default wait will wait for all jobs to finish and then return a success exit code, however if you give it a specific job ID it will instead return the exit code of the waited-on process:
$ (sleep 10; false)
^Z
[1]+ Stopped ( sleep 10; false )
$ wait %% && echo ok || echo nok
[1]+ Exit 1 ( sleep 10; false )
nok
- baobun 10mo agoGreat! And no plugins or scripts needed. Thank you!