From 6a1add686c7b5b1dccdb2a9c3a9334fd8e030d68 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 15 Apr 2021 08:14:38 -0300 Subject: Feat: show: inotify watch support --- show | 9 +++++++++ 1 file changed, 9 insertions(+) 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..." -- cgit v1.2.3