m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2015-01-19 13:38:14 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2015-01-19 13:38:14 +0100
commit2c02186ea66b1500d758f6f30222079558bcd1c9 (patch)
tree51369de9b57d58282fba8eb3dbc45928b8ca5658
parentf924746af684d44abe1fd67eb681ed10438819a8 (diff)
Correct path for top level grep
-rwxr-xr-xsrc/password-store.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index d4e9515..160250f 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -346,9 +346,10 @@ cmd_grep() {
[ $? -ne 0 ] && continue
passfile="${passfile%.gpg}"
passfile="${passfile#$PREFIX/}"
- local passfile_dir="${passfile%/*}"
+ local passfile_dir="${passfile%/*}/"
+ [[ $passfile_dir == "${passfile}/" ]] && passfile_dir=""
passfile="${passfile##*/}"
- printf "\e[94m%s/\e[1m%s\e[0m:\n" "$passfile_dir" "$passfile"
+ printf "\e[94m%s\e[1m%s\e[0m:\n" "$passfile_dir" "$passfile"
echo "$grepresults"
done < <(find -L "$PREFIX" -iname '*.gpg' -print0)
}