summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaramc@gmail.com>2018-05-24 16:46:01 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-24 13:26:23 +0200
commitdda2ecce34de808d22b4b0f388bd1cb640158a29 (patch)
tree8f9245c8ce3143f504b2ad77fa0e05a344595fe4 /src/password-store.sh
parentfab65bda88ea979dbbc49f3d856a1d14ee4f1296 (diff)
downloadpass-dda2ecce34de808d22b4b0f388bd1cb640158a29.tar.gz
pass-dda2ecce34de808d22b4b0f388bd1cb640158a29.tar.bz2
pass-dda2ecce34de808d22b4b0f388bd1cb640158a29.zip
grep: allow grep options and arguments
Allow grep options and arguments. Typical uses may be, for instance, wanting to ignore case ('-i'), print a few lines of context around the matched line, multiple patterns with '-e', etc. (background: grep is deprecating GREP_OPTIONS, so eventually that will stop working).
Diffstat (limited to 'src/password-store.sh')
-rwxr-xr-xsrc/password-store.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index eac5404..19b3124 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -395,10 +395,10 @@ cmd_find() {
}
cmd_grep() {
- [[ $# -ne 1 ]] && die "Usage: $PROGRAM $COMMAND search-string"
- local search="$1" passfile grepresults
+ [[ $# -lt 1 ]] && die "Usage: $PROGRAM $COMMAND search-string"
+ local passfile grepresults
while read -r -d "" passfile; do
- grepresults="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | grep --color=always "$search")"
+ grepresults="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | grep --color=always "$@")"
[[ $? -ne 0 ]] && continue
passfile="${passfile%.gpg}"
passfile="${passfile#$PREFIX/}"
Specify variable gpg.Jason A. Donenfeld1-1/+1 2014-04-18style: don't escape new line on &&Jason A. Donenfeld1-2/+2 2014-04-18reencryption: remove temporary file on failureJason A. Donenfeld1-1/+1 2014-04-18reencryption: only reencrypt files when requiredJason A. Donenfeld2-16/+37 2014-04-17cp: typo as cvJason A. Donenfeld1-1/+1 2014-04-17bash: gpg_id is localJason A. Donenfeld1-0/+1 2014-04-17move/copy: always reencrypt passwords at destinationJason A. Donenfeld5-25/+56 2014-04-17makefile: allow platform files with gnu sedJason A. Donenfeld1-7/+8 2014-04-17mv: Add pass mv/rename supportJason A. Donenfeld5-3/+78 2014-04-17revelation2pass: add plain XML importJavali1-11/+15 2014-04-17platform: add cygwin supportJason A. Donenfeld2-1/+17