Using pass in command substitution
Conrad Hughes
org_password_store at xrad.org
Fri Aug 2 16:49:36 UTC 2024
> 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
More information about the Password-Store
mailing list