commit 369bd733f9be580257128564226e2952c0215b39
parent 9c319f1edb2916f725c9c394e38f665ff3aeccd8
Author: Klemens Nanni <kl3@posteo.org>
Date: Fri, 3 Jun 2016 03:34:15 +0200
Immediately stop searching on second match
If the given keyword is too ambigious, find(1) now aborts as soon as
possible. Otherwise it would yield every other matching entry for
nothing.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/spm.sh b/spm.sh
@@ -34,7 +34,8 @@ _find() {
[ -z "${1}" ] && die 'Name must not be empty.'
ENTRY=$(find "${STORE_DIR}" \( -type f -o -type l \) \
- -iwholename "*${1}*".gpg)
+ -iwholename "*${1}*".gpg \
+ | head -n2)
[ -z "${ENTRY}" ] && ENTRY= && die 'No such entry.'