From: Silvio Rhatto Date: Thu, 15 Apr 2021 11:14:38 +0000 (-0300) Subject: Feat: show: inotify watch support X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=6a1add686c7b5b1dccdb2a9c3a9334fd8e030d68;p=scripts.git Feat: show: inotify watch support --- diff --git a/show b/show index 4be01ac..2195702 100755 --- a/show +++ b/show @@ -4,6 +4,7 @@ # # Parameters +PROGRAM="$0" BASENAME="`basename $0`" DOCS="$HOME/data/doc" FILELIST=".filelist" @@ -59,6 +60,14 @@ fi if [ "$ITEM" == "--search" ]; then shift grep -i -- "$*" $LIST +elif [ "$ITEM" == "--watch" ]; then + ( + cd $DOCS + + while inotifywait -e modify -e create -e move -e delete .; do + $PROGRAM --refresh + done + ) else grep -i -- "$ITEM" $LIST | while read entry; do echo "Opening $entry..."