From 46780a1c76886ff4af4176ea3534c216f0828d04 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 5 Feb 2016 22:27:18 +0100 Subject: show: better clip error message --- src/password-store.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3