Last active
August 29, 2015 14:01
-
-
Save linpc/f2b7bcb41943d51e73ad to your computer and use it in GitHub Desktop.
job control in script
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
#!/usr/bin/env bash | |
set -m | |
sleep 100 & | |
echo "sleep in background..." | |
echo | |
echo "make sleep going to foreground." | |
echo "How about try use ^Z to make it background again ?" | |
echo | |
fg | |
echo "sleep done" |
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
#!/usr/bin/env bash | |
# turn on monitor mode | |
# set -m | |
set -o monitor | |
sleep 100 & | |
jobs | |
echo "sleep in background..." | |
echo | |
echo "make sleep going to foreground." | |
echo "How about try use ^Z to make it background again ?" | |
echo | |
fg | |
jobs | |
# turn off monitor mode | |
set +o monitor | |
sleep 5 | |
jobs | |
echo "sleep done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment