monfold.sh: Use tabs instead of mixed tabs/spaces for indentation
authorW. Trevor King <wking@tremily.us>
Sat, 21 Sep 2013 17:24:34 +0000 (10:24 -0700)
committerW. Trevor King <wking@tremily.us>
Sat, 21 Sep 2013 17:41:46 +0000 (10:41 -0700)
Then folks can set the tab width to whatever they want and still get
indentation that makes sense.

posts/inotify/monfold.sh

index 33d10356a477128508c918536324b0df6f27376e..14ba57ec4e62f3e81d5a1a5656d2a4483651ac53 100755 (executable)
@@ -17,8 +17,8 @@
 # grabbing the upper window.
 
 if [ $# -ne 1 ]; then
-    echo "usage: monfold <unfold_dir>"
-    exit 1
+       echo "usage: monfold <unfold_dir>"
+       exit 1
 fi
 
 DATADIR="$1"
@@ -57,24 +57,24 @@ EOF
 LASTFILE=""
 # Multiple close events for the same file as data is written in blocks
 while read LINE; do
-    DIR=`echo "$LINE" | awk '{print  $1}'` # has trailing slash
-    EVENT=`echo "$LINE" | awk '{print  $2}'`
-    FILE=`echo "$LINE" | awk '{print  $3}'`
-    if [ "$EVENT" != "CLOSE_WRITE,CLOSE" ]; then
-       echo "Error (unexpected event '$EVENT'):"
-       echo "$LINE"
-       exit 1
-    fi
-    if [ "$FILE" != "$LASTFILE" ] && [ "$LASTFILE" != "" ]; then
-       # We must have finished writing to $LASTFILE...
-       echo "process $DIR$LASTFILE -> $OUTFILE"
-       ln -s "$DIR$LASTFILE" "$DATALINK"
-       gnuplot "$GPFILE"
-       rm "$DATALINK"
-       echo $ACTION
-       $ACTION
-    fi
-    LASTFILE="$FILE"
+       DIR=`echo "$LINE" | awk '{print  $1}'` # has trailing slash
+       EVENT=`echo "$LINE" | awk '{print  $2}'`
+       FILE=`echo "$LINE" | awk '{print  $3}'`
+       if [ "$EVENT" != "CLOSE_WRITE,CLOSE" ]; then
+               echo "Error (unexpected event '$EVENT'):"
+               echo "$LINE"
+               exit 1
+       fi
+       if [ "$FILE" != "$LASTFILE" ] && [ "$LASTFILE" != "" ]; then
+               # We must have finished writing to $LASTFILE...
+               echo "process $DIR$LASTFILE -> $OUTFILE"
+               ln -s "$DIR$LASTFILE" "$DATALINK"
+               gnuplot "$GPFILE"
+               rm "$DATALINK"
+               echo $ACTION
+               $ACTION
+       fi
+       LASTFILE="$FILE"
 done < <(inotifywait -q -m -e CLOSE_WRITE --exclude '.*unfold_.*' "$DATADIR")
 
 rm "$GPFILE"