From 3d7e7b011996345b1c57e8759e47a0a47f4a41ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 12 Apr 2020 17:29:42 +0200 Subject: Fix order of conditions --- src/password-store.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/password-store.sh b/src/password-store.sh index 76620cd..35e7a51 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -387,10 +387,7 @@ cmd_show() { local passfile="$PREFIX/$path.gpg" check_sneaky_paths "$path" if [[ -f $passfile ]]; then - if [[ $clip -eq 0 && $qrcode -eq 0 ]]; then - pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | $BASE64)" || exit $? - echo "$pass" | $BASE64 -d - elif [[ $user -eq 1 ]]; then + if [[ $user -eq 1 ]]; then local user="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | grep -m 1 "^${USER_STRING}" | sed -e "s/^${USER_STRING}"'\(.*\)/\1/')" [[ -n $user ]] || exit 1 @@ -402,6 +399,9 @@ cmd_show() { else echo "$user" fi + elif [[ $clip -eq 0 && $qrcode -eq 0 ]]; then + pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | $BASE64)" || exit $? + 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 $? -- cgit v1.2.3