From e27949702d25bbe0e9153cf3afea158104c0c383 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 26 Mar 2023 23:07:28 +0800 Subject: xdiff : make sure $DIR is valid if user run `xdiff --help` , `--help` gets passed to find as an arg, it will cause infinite vimdiff instance coming out, has to kill xdiff's pid to stop it. --- xdiff | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xdiff b/xdiff index 626e2e5..b388c76 100755 --- a/xdiff +++ b/xdiff @@ -21,6 +21,11 @@ fi DIR=${1:-/etc} +if ! [ -d "$DIR" ] ; then + echo "$DIR is not a valid directory" >&2 + exit 1 +fi + for newfile in $(find "$DIR" -name '*.new-*_*' | sort -V); do $DIFF "$newfile" "${newfile%.new-*_*}" done -- cgit 1.4.1