diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-05 22:27:18 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-05 22:29:40 +0100 |
commit | 46780a1c76886ff4af4176ea3534c216f0828d04 (patch) | |
tree | 70a5d247ac1dfe22d7c58e4fe35919bfef9d7b68 | |
parent | c32b43e5c3ba25c711780db63fce4012dcea2e27 (diff) |
show: better clip error message
-rwxr-xr-x | src/password-store.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index 9ea97ca..a6b3400 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -313,9 +313,9 @@ cmd_show() { if [[ $clip -eq 0 ]]; then $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $? else - [[ $clip_location =~ ^[0-9]+$ ]] || die "Clip location '$clip_location' is not a number" - local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n $clip_location | tail -n 1)" - [[ -n $pass ]] || exit 1 + [[ $clip_location =~ ^[0-9]+$ ]] || die "Clip location '$clip_location' is not a number." + local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${clip_location} | head -n 1)" + [[ -n $pass ]] || die "There is no password to put on the clipboard at line ${clip_location}." clip "$pass" "$path" fi elif [[ -d $PREFIX/$path ]]; then |