From org_password_store at xrad.org Fri Aug 2 16:49:36 2024 From: org_password_store at xrad.org (Conrad Hughes) Date: Fri, 02 Aug 2024 17:49:36 +0100 Subject: Using pass in command substitution In-Reply-To: <877cdeu609.fsf@city17.xyz> References: <877cdeu609.fsf@city17.xyz> Message-ID: > I think I need some rubberduck debugging from you folks. It looks as if you've got a complete handle on this situation and have the fix in hand as well: if you run those pass commands directly in the shell, you'll get the output that your `token=$(...)` assignments retrieve, and in your later example you demonstrate how you've fixed that when using wl-copy too (although the '|' in `| wl-paste` could probably be an '&&' according to taste). You don't explicitly state what the problem and expectation are, but if you want to both assign the password to $token and clip it, you either need to run pass twice or use something like the wl-paste trick you demonstrate at the end. It looks to me as if running pass --clip in a subshell forces a wait until it clears the clipboard though, so this is what worked for me: pass logins/website --clip=1 && token=$(xclip -selection clipboard -out) I guess you'll use wl-paste instead of xclip. Conrad From password-store at city17.xyz Fri Aug 2 19:53:12 2024 From: password-store at city17.xyz (jman) Date: Fri, 02 Aug 2024 21:53:12 +0200 Subject: Using pass in command substitution In-Reply-To: (Conrad Hughes's message of "Fri, 02 Aug 2024 17:49:36 +0100") References: <877cdeu609.fsf@city17.xyz> Message-ID: <8734nmu2fr.fsf@city17.xyz> Conrad Hughes writes: > You don't explicitly state what the problem and expectation are, but if > you want to both assign the password to $token and clip it, you either > need to run pass twice or use something like the wl-paste trick you > demonstrate at the end. Right, all I wanted was being able to copy the password and at the same time having in on stdout in one go using the "show" command + the --clip parameter, avoiding the piping dance. The inline documentation says: pass [show] [--clip[=line-number],-c[line-number]] pass-name Show existing password and optionally put it on the clipboard. If put on the clipboard, it will be cleared in 45 seconds. which led me to think it was possible but apparently it is not. Not a big deal anyway. Thanks!