noninteractive "pass insert" fails

Frank Thommen f.thommen at dkfz-heidelberg.de
Fri Jul 27 16:58:25 CEST 2018


Hello Ernesto,

On 07/27/2018 04:32 PM, Ernesto Alfonso wrote:
> Hi,
> 
> I need to generate a numeric pin but pass seems to only support a yes/no 
> special characters flag.
> 
> So I generate my own pin:
> 
>      PIN=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${LENGTH})
> 
> When I try to insert that into pass via standard in:
> 
>      pass insert ${NAME} <<< $PIN
> 
> I get exit status 1 with no error message, and no password is inserted.
> 
> - How can I insert a password non-interactively?

For me this works:

     echo "$PIN" | pass insert --echo ${NAME}
or
     pass insert --echo ${NAME} <<<$PIN

important is the "--echo"


> - Alternatively, how can I generate a numeric pin with no alpha characters?
> - Should pass provide an error message when it fails?

It provides an appropriate exit status of >0.

Cheers
frank


More information about the Password-Store mailing list