Den 18/01/2023 23:46, skreiv Judd Montgomery:
  From 4b547b5332110c19ebdc8802d1cd628979ade59a Mon Sep 17 00:00:00 2001
From: Judd Montgomery <[email protected]>
Date: Wed, 18 Jan 2023 17:32:56 -0500
Subject: [PATCH] The pipe to a tail and then head -1 can fail due to a
   pipefail.
   
https://stackoverflow.com/questions/22464786/ignoring-bash-pipefail-for-error-code-141
   Since sed is used elsewhere in the script, using sed seems simpler and
more
   performant.


diff --git a/src/password-store.sh b/src/password-store.sh
index 22e818f..8ea4d65 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -388,7 +388,7 @@ cmd_show() {
                          echo "$pass" | $BASE64 -d
                  else
                          [[ $selected_line =~ ^[0-9]+$ ]] || die "Clip
location '$selected_line' is not a number."
-                       pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" |
tail -n +${selected_line} | head -n 1)" || exit $?
+                       pass=$("$GPG" -d "${GPG_OPTS[@]}" "$passfile" |
sed -n "${selected_line}"p)
                          [[ -n $pass ]] || die "There is no password to
put on the clipboard at line ${selected_line}."
                          if [[ $clip -eq 1 ]]; then
                                  clip "$pass" "$path"




I'm sorry to say your e-mail client really chewed that up and spat it out in mangled pieces. those are no-break-spaces for the indentation, random line breaks thrown in, etc.

--
Kjetil T. Homme
Redpill Linpro - Changing the game

Reply via email to