当我使用 `$ pass insert [...]` 时终端挂起

当我使用 `$ pass insert [...]` 时终端挂起

这篇文章是关于实用程序的pass。它对我来说很好用,除了我尝试使用

$ pass insert Email/gmail/myname

我的终端给出提示

Enter password for Email/gmail/myname: _

并挂起,到目前为止,除了Ctrl-C停止程序外,没有任何按键影响它。有趣的是,该程序确实创建了目录~/.local/share/password-store/Email/gmail/。以前有人遇到过同样的问题吗?

pass(我在 arch 上使用v1.7.3。)

答案1

对于交互式插入,该enter键表示您已完成输入密码:

$ pass insert test
Enter password for test:   [keystrokes: asdf<enter>]
Retype password for test:  [keystrokes: asdf<enter>]

$ pass test
adsf

此外,您可以使用--echo-e通过管道中的 stdin 获取输入。

例如,我testo使用密码进行输入hello world

$ echo "hello world" | pass insert --echo testo
[main b451b23] Add given password for testo to store.
 1 file changed, 1 insertion(+)
 create mode 100644 testo.gpg

$ pass testo
hello world

但这仅适用于单行输入。对于多行输入,请使用 标志--multiline而不是--echo

$ man pass
$ echo "password123" > passfile.txt
$ echo "Email: [email protected]" >> passfile.txt
$ cat passfile.txt | pass insert --multiline test
Enter contents of test and press Ctrl+D when finished:

[main e1acd8e] Add given password for test to store.
 1 file changed, 1 insertion(+)
 create mode 100644 test.gpg

$ pass test
password123
Email: [email protected]

手册页上的文档没有提到按下enter以终止输入,也许我会通过电子邮件发送开发邮件列表关于它。以下是当前的man pass

       insert [ --echo, -e | --multiline, -m ] [ --force, -f ] pass-name
              Insert  a  new  password  into the password store called pass-name. This will read the new password from standard in. If --echo or -e is not
              specified, disable keyboard echo when the password is entered and confirm the password by asking for it twice. If --multiline or -m is spec‐
              ified,  lines will be read until EOF or Ctrl+D is reached. Otherwise, only a single line from standard in is read. Prompt before overwriting
              an existing password, unless --force or -f is specified. This command is alternatively named add.

相关内容