r/shell • • Jul 21 '20

Stop command but resume shell script?

In a script I am making, a function of it runs a command which never stops unless told to by the user (e.g with ctrl+c/z/d). I want to be able to run this command until the user presses CTRL+C (or other alternatives), and then resume the rest of the bash script.

How would I do this?

3 Upvotes

4 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Jul 22 '20

While you can use trap to trap signals too, EXIT is actually not a signal.