summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-12 17:29:42 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-12 17:29:42 +0200
commit32e08cd6931613330169e1398115fedfd28ec47b (patch)
tree792d61d91a78c0de98d5131e10122e1cef0af538
parent09ad6e6e826fe77492598d787b720ea34f0c082a (diff)
downloadpass-32e08cd6931613330169e1398115fedfd28ec47b.tar.gz
pass-32e08cd6931613330169e1398115fedfd28ec47b.tar.bz2
pass-32e08cd6931613330169e1398115fedfd28ec47b.zip
Fix order of conditions
-rwxr-xr-xsrc/password-store.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 1b2c5a8..bf00df4 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -385,10 +385,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
@@ -400,6 +397,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 $?