Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# james shubin, agplv3+
# pause until key press and then continue
if [ ! "$#" -eq 1 ]; then
echo "Usage: `basename $0` <process>"
echo "Pauses process until key press and then continues!"
exit 1
echo "Stopping '$1'..."
killall -SIGSTOP "$1"
if [ $e -ne 0 ]; then
echo "Could not pause '$1', error '$e'."
exit $e
echo "[press any key to continue]"
#read -n1 -r -s -p "[press any key to continue]" key
read -n1 -r -s key
tput cuu 1 && tput el # remove last line
echo "Continuing '$1'..."
#echo # newline
killall -SIGCONT "$1"
exit $?

imho, you should use the procps pkill rather than killall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment