diff options
| author | Calvin Morrison <mutantturkey@gmail.com> | 2014-04-07 17:33:52 -0400 |
|---|---|---|
| committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-04-07 17:33:52 -0400 |
| commit | a76371cf30bfd945b75b81a77a02a26a67b7478c (patch) | |
| tree | 2e4010891d146e75a740b58553f365e4aaeca806 /lock | |
lock, a simple lock utility
Diffstat (limited to 'lock')
| -rwxr-xr-x | lock | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ +lock() { + + if ! mkdir "$1" &>/dev/null; then + while true; do + sleep 2; + if [[ ! -d "$1" ]]; then + return + fi + done + fi; + +} + +lock $1 |
