commit 21cefad6468e4c8fde541bbb5ea568bb842b6fc2
parent 8388a00ab366dfa0660ed11d6560959a44686def
Author: Chris Down <chris@chrisdown.name>
Date: Sun, 22 Apr 2018 10:19:54 +0100
Merge branch 'release/5.3.0'
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git 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,9 +44,14 @@ 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
+ printf '%s\n' 'No pattern provided, see --help' >&2
+ exit 2
+fi
+
exec {lock_fd}> "$lock_file"
if (( CM_REAL_DELETE )) && [[ "$raw_pattern" == ".*" ]]; then