From a77c2731ba86ac5370b1acadcad2a823ded47047 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Sun, 22 Apr 2018 10:19:03 +0100 Subject: [PATCH] clipdel: Don't take "-d" as the pattern if only "-d" was passed --- clipdel | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clipdel b/clipdel index ea4e19c..d3ca5cd 100755 --- a/clipdel +++ b/clipdel @@ -2,7 +2,10 @@ : "${CM_DIR="${XDG_RUNTIME_DIR-"${TMPDIR-/tmp}"}"}" CM_REAL_DELETE=0 -[[ $1 == -d ]] && CM_REAL_DELETE=1 +if [[ $1 == -d ]]; then + CM_REAL_DELETE=1 + shift +fi major_version=5 @@ -41,7 +44,7 @@ fi # https://github.com/koalaman/shellcheck/issues/1141 # shellcheck disable=SC2124 -raw_pattern=${@: -1} +raw_pattern=$1 esc_pattern=${raw_pattern/\#/'\#'} if ! [[ $raw_pattern ]]; then