The variable GREP_OPTIONS has been deprecated in GNU grep and will result in a
warning if used. They can be passed down from the outside directly.
---
man/pass.1 | 5 ++---
src/password-store.sh | 10 ++++++----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/man/pass.1 b/man/pass.1
index 93f7e65..2536fac 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -74,12 +74,11 @@ by using the
.BR tree (1)
program. This command is alternatively named \fBlist\fP.
.TP
-\fBgrep\fP \fIsearch-string\fP
+\fBgrep\fP [ \fIgrep-options\fP ] \fIsearch-string\fP
Searches inside each decrypted password file for \fIsearch-string\fP, and displays matching
lines along with password names. Uses
.BR grep (1)
-for matching. Make use of the \fIGREP_OPTIONS\fP environment variable to set particular
-options.
+for matching.
.TP
\fBfind\fP \fIpass-names\fP...
List names of passwords inside the tree that match \fIpass-names\fP by using the
diff --git a/src/password-store.sh b/src/password-store.sh
index 83ecc3a..e6876b2 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -226,7 +226,7 @@ cmd_usage() {
$PROGRAM [show] [--clip,-c] pass-name
Show existing password and optionally put it on the clipboard.
If put on the clipboard, it will be cleared in $CLIP_TIME seconds.
- $PROGRAM grep search-string
+ $PROGRAM grep [grep options] search-string
Search for password files containing search-string when decrypted.
$PROGRAM insert [--echo,-e | --multiline,-m] [--force,-f] pass-name
Insert new password. Optionally, echo the password back to the console
@@ -338,13 +338,15 @@ cmd_find() {
}
cmd_grep() {
- [[ $# -ne 1 ]] && die "Usage: $PROGRAM $COMMAND search-string"
- local search="$1" passfile label
+ [[ $# -eq 0 ]] && die "Usage: $PROGRAM $COMMAND [grep options] search-string"
+ local passfile label
while read -r -d "" passfile; do
label="${passfile%.gpg}"
label="${label#"$PREFIX"}"
label="${label#/}"
- $GPG -d "${GPG_OPTS[@]}" "$passfile" | grep --color=auto --label="$label" -H "$search"
+ # The user supplied options come after our defaults so that
+ # they can override the defaults.
+ $GPG -d "${GPG_OPTS[@]}" "$passfile" | grep --color=auto --label="$label" -H "$@"
done < <(find -L "$PREFIX" -iname '*.gpg' -print0)
}
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store