Last active
April 28, 2019 16:29
-
-
Save purpleidea/79e18e66f42ff34d96d4a1fe835124d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# james shubin, agplv3+ | |
# pause until key press and then continue | |
# https://ttboj.wordpress.com/2017/01/06/ten-minute-hacks-process-pause-resume | |
if [ ! "$#" -eq 1 ]; then | |
echo "Usage: `basename $0` <process>" | |
echo "Pauses process until key press and then continues!" | |
exit 1 | |
fi | |
echo "Stopping '$1'..." | |
killall -SIGSTOP "$1" | |
e=$? | |
if [ $e -ne 0 ]; then | |
echo "Could not pause '$1', error '$e'." | |
exit $e | |
fi | |
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 $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
imho, you should use the procps
pkill
rather thankillall