Created
April 4, 2017 10:04
-
-
Save nathanchere/b3dd78cf05138b24147284fdf8776adf to your computer and use it in GitHub Desktop.
Check if current script is running in the foreground or background
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 | |
if [ -z `ps -o stat= | tail -n 1 | grep +` ]; then | |
echo 'Running in background!' | |
else | |
echo 'Running in foreground!' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment