Created
November 23, 2018 14:27
-
-
Save martinda/2e5c6d10f441c61949d09936f43d83bf to your computer and use it in GitHub Desktop.
How to kill a bash function and what it runs
This file contains hidden or 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 | |
set -o xtrace | |
function task { | |
cat /dev/random >/dev/null | |
} | |
task & pid=$! | |
sleep 1 | |
ps -fH | |
kill $pid | |
ps -fH | |
# At this point we see that the 'cat' is still running |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment