entr (422B)
1 #!/bin/sh 2 3 if [ "$#" -eq 0 ]; then 4 echo "$0: no arguments given" >&2 5 exit 1 6 fi 7 8 trigger_file=`cat` 9 if ! [ -f "$trigger_file" ]; then 10 echo "$trigger_file: file doesn't exist" >&2 11 exit 1 12 fi 13 14 "$@" 15 oldhash=$(cat "$trigger_file" | md5sum) 16 for (( ; ; )) 17 do 18 newhash=$(cat "$trigger_file" | md5sum) 19 if [ "$newhash" != "$oldhash" ]; then 20 newhash=$(cat "$trigger_file" | md5sum) 21 oldhash=$newhash 22 "$@" 23 fi 24 sleep .5 25 done