Using pass in command substitution

jman password-store at city17.xyz
Tue Jul 30 16:25:40 UTC 2024


Hi,

I think I need some rubberduck debugging from you folks.

I use pass like this:

  $ token=$( pass logins/website | head -n1 )

This works fine: as expected, in $token there is the password. However when using the --clip flag:

  $ token=$( pass logins/website --clip=1 )

the resulting variable $token contains the text "Copied xxx to clipboard. Will clear in NNN 
seconds." instead of the password.

My $copy_cmd in the pass script is set to "wl-copy" (I use Wayland/Sway). Running something like 
this produces the same result:

  $ TEST=$( echo -n heyhey | wl-copy ) && echo $TEST
  $ <empty line>

but:

  $ TEST=$( echo -n heyhey | wl-copy | wl-paste ) && echo $TEST
  $ heyhey

I am not sure of what am I looking at. Is this is the expected behaviour?

Any ideas/suggestion?

Thanks!


More information about the Password-Store mailing list