From 562812fb642fcc03a0781fa49170dbb607a90f5b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 24 Apr 2014 18:07:27 +0200 Subject: find: proper segmenting of terms --- src/password-store.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/password-store.sh b/src/password-store.sh index 657f0e5..c3824f9 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -343,9 +343,9 @@ cmd_find() { echo "Usage: $PROGRAM $COMMAND pass-names..." exit 1 fi - local terms="$*" - echo "Search Terms: $terms" - tree -C -l --noreport -P "*${terms// /*|*}*" --prune --matchdirs --ignore-case "$PREFIX" | tail -n +2 | sed 's/\.gpg$//' + IFS="," eval 'echo "Search Terms: $*"' + local terms="*$(printf '%s*|*' "$@")" + tree -C -l --noreport -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" | tail -n +2 | sed 's/\.gpg$//' } cmd_grep() { -- cgit v1.2.3