On 18/12/2019 11.39, Rune Juhl Jacobsen wrote:
Ouch, it seems like my editor ate a newline in the diff; sorry.
Hopefully this works better...
diff --git a/src/password-store.sh b/src/password-store.sh
index 77f3eda..ce3f7fb 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -99,7 +99,7 @@ set_gpg_recipients() {
verify_file "$current"
local gpg_id
- while read -r gpg_id; do
+ grep -Eo '^[^#]+' | grep -Ev '^\s*$' | while read -r gpg_id; do
GPG_RECIPIENT_ARGS+=( "-r" "$gpg_id" )
GPG_RECIPIENTS+=( "$gpg_id" )
done < "$current"
grep -o is very useful, but not portable (not in POSIX).
https://pubs.opengroup.org/onlinepubs/009695399/utilities/grep.html
"Amir Yalon" <[email protected]> writes:
It may be simpler to do gpg_id="${gpg_id%%#*}" instead.
indeed, that is much simpler and more sensible! why didn't I think of
that :-)
--- src/password-store.sh
+++ src/password-store.sh
@@ -99,6 +99,7 @@ set_gpg_recipients() {
local gpg_id
while read -r gpg_id; do
+ gpg_id="${gpg_id%%#*}" # strip comment
GPG_RECIPIENT_ARGS+=( "-r" "$gpg_id" )
GPG_RECIPIENTS+=( "$gpg_id" )
done < "$current"
--
Kjetil T. Homme
Redpill Linpro - Changing the Game
_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store