From 2f8fd807b24c2a9753353b04fdd937eb9e8fe6a2 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Mon, 15 Oct 2012 22:10:27 +1100 Subject: [PATCH] monitor_dir: use comm instead of diff --- bin/monitor_dir | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/monitor_dir b/bin/monitor_dir index 5277f56..ce5cd50 100755 --- a/bin/monitor_dir +++ b/bin/monitor_dir @@ -4,15 +4,15 @@ # */5 * * * * $HOME/bin/monitor_dir /path/to/something if [ -z "$1" ]; then - echo "Usage $0 dir [monitor_file] [ls-options]" + echo "Usage $0 dir [monitor_file] [ls]" exit 1 fi mon="${2:-$1/.monitor_dir}" mon_tmp="${mon}_tmp" -ls "${3:--tlR}" "$1" > "$mon_tmp" +${3:-ls} "$1" > "$mon_tmp" if [ -r "$mon" ] && ! cmp -s "$mon" "$mon_tmp" && [ -n "$(ls "$1")" ]; then - diff "$mon" "$mon_tmp" | grep '^> ' | sed 's/^> //' + comm -13 "$mon" "$mon_tmp" fi mv "$mon_tmp" "$mon" -- 2.39.2