commit 109830edc83789d98c1795fd73b4126284cb09a5
parent 677e0b48f3eae061996bc64d516cab48c03b97f3
Author: gearsix <gearsix@tuta.io>
Date:   Fri, 26 Aug 2022 11:04:10 +0100
nix/onfilech: added help & reduced sleep period
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/nix/onfilech.sh b/nix/onfilech.sh
@@ -4,6 +4,13 @@
 # dependencies: stat
 # e.g.$ onfilech draft-plans.txt cp draft-plans.txt new-plans.txt
 
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+	echo "Usage: onfilech FILE COMMAND..."
+	echo ""
+	echo "run COMMAND every time a change is made to FILE"
+	exit
+fi
+
 file=$1; shift
 cmd=$*
 
@@ -14,6 +21,6 @@ while true; do
 		if [ "$upd" != "$mod" ]; then
 			$cmd; echo update; mod=false;
 		fi;
-		sleep 10;
+		sleep 3;
 	done;
 done;