1
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?
1
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?
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.
Indeed, Ctrl-Z suspends a process using SIGSTOP. Sourced scripts run in the main shell process and cannot be suspended as a unit. – user1686 – 2012-01-19T20:56:42.130