Last active
November 6, 2017 01:38
-
-
Save kputnam/4ef1b3f3b885510a6200bdae4ff5d1a6 to your computer and use it in GitHub Desktop.
Bash script tricks
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/sh | |
# make sure we aren't running already | |
what=`basename $0` | |
for p in `ps h -o pid -C $what`; do | |
if [ $p != $$ ]; then | |
exit 0 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment