From a76371cf30bfd945b75b81a77a02a26a67b7478c Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Mon, 7 Apr 2014 17:33:52 -0400 Subject: lock, a simple lock utility --- lock | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 lock (limited to 'lock') diff --git a/lock b/lock new file mode 100755 index 0000000..b4b285d --- /dev/null +++ b/lock @@ -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 -- cgit v1.2.3