Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run a process in Bash, I can suspend it with Ctrl-Z, but that does not seem to work for sourced scripts (. foo.sh). Is there a way to suspend such scripts?

share|improve this question

1 Answer 1

When you source foo.sh, Ctrl+Z (SUSP) just stops the currently executing command in foo.sh and the shell blithely carries on with the next command in foo.sh.

I don't think there's a way round this. If you want to be able to suspend the whole of foo.sh you have to be running it as a subprocess by invoking it as a command not by sourcing it.

share|improve this answer
Indeed, Ctrl-Z suspends a process using SIGSTOP. Sourced scripts run in the main shell process and cannot be suspended as a unit. –  grawity Jan 19 '12 at 20:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.