On 28/06/2020 20.54, yvh11a wrote:
Hello everyone, nice to meet you all.
Assuming I have secrets stored in zx2c4.com as follows:
hunter2
[email protected]
I can do the following:
pass -c zx2c4.com -> sends hunter2 to clipboard
pass -c2 zx2c4.com -> sends [email protected] to the clipboard
pass zx2c4.com -> sends hunter2 to stdout
????? -> how to send [email protected] to stdout?
I'd like to know if there's a way to send arbitrary lines to stdout,
as can be done to the clipboard. Alternatively, commit 3a108277 seems
to allow extraction of fields other than the password, but only for
emacs. Does something similar exist from the command line? Meaning,
if I modified my file as such:
hunter2
email: [email protected]
could I do something like
pass zx2c4.com :email -> send [email protected] to stdout
there are so many ways to do this in Unix. the version which probably
is least typing for the first usecase is
pass zx2c4.com | sed -n 2p
-n turns off default print, 2p means on line 2, print.
your second feature is more awkward to type, so put it in an alias or
function in your .bashrc:
get() { sed -n "s/^$1: *//p"; }
usage will be:
pass zx2c4.com | get email
--
Kjetil T. Homme
Redpill Linpro - Changing the Game