pipe w/o -e
branson matheson
branson at sandsite.org
Wed Feb 5 00:00:54 CET 2020
Ran into an issue where
echo "password" | pass insert foo/bar/baz
was in shell code.. and ran but:
- should have had '-e' expressly on the C/L
- created ~/.password-store/foo/bar .. but no baz.gpg
- returned no visible error because the read's tromped the input lines
Was frustrating to review the code using sh -xv and see what transpired. A simple fix offered for this:
> git diff master
diff --git a/src/password-store.sh b/src/password-store.sh
index 77f3eda..ed7927a 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -459,6 +459,9 @@ cmd_insert() {
echo
$GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" || die "Password encryption aborted."
elif [[ $noecho -eq 1 ]]; then
+ if ! [[ -t 0 ]]; then
+ die "use -e if not interactive"
+ fi
local password password_again
while true; do
read -r -p "Enter password for $path: " -s password || exit 1
Happy days.
-b
branson matheson
branson at sandsite.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20200204/ecc4bc32/attachment.html>
More information about the Password-Store
mailing list