diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2015-01-19 13:38:14 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2015-01-19 13:38:14 +0100 |
commit | 2c02186ea66b1500d758f6f30222079558bcd1c9 (patch) | |
tree | 51369de9b57d58282fba8eb3dbc45928b8ca5658 | |
parent | f924746af684d44abe1fd67eb681ed10438819a8 (diff) |
Correct path for top level grep
-rwxr-xr-x | src/password-store.sh | 5 |
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) } |