我在以下shell别名中使用rlwrap实用程序:
alias gp='rlwrap git push'这个gp别名的目的是在我使用git push命令时,能够使用基本行编辑命令(如C-a或C-e )到达命令行的开头或结尾。
我还将rlwrap配置为在专用文件(~/.config/rlwrap/<command>_history)中编写用于它的每个命令的输入历史记录:
export RLWRAP_HOME="${HOME}/.config/rlwrap"当我使用gp别名时,我必须给出我的凭据、用户名和密码,rlwrap将它们保存在~/.config/rlwrap/git_history中。
是否可以让rlwrap保存我使用的所有命令的输入历史记录,除了密码,例如在gp别名中?
发布于 2017-07-18 08:15:57
我必须给出我的凭据、用户名和密码,然后将它们保存在~/..config/ rlwrap /git_history中。
您确定rlwrap确实在其历史文件中保存了密码吗?根据设计,没有回显回显的输入永远不会放在历史列表中(在这种情况下,rlwrap会将您的击键响应为****),我检查了它,至少在我的系统中,这也是git push发生的情况。
如果您真的在历史文件中看到您的密码,请在rlwraps GitHub站点上输入一个bug。
发布于 2017-07-02 11:41:58
我想我找到了一种方法来防止保存当前的输入行。来自man rlwrap:
SPECIAL KEYS
Control + O
Accept the current line, but don't put it in the history list. This action has a readline command name
rlwrap-accept-line-and-forget因此,与使用Enter验证行不同,如果我使用C-o进行验证,则不应该保存它。
也许我也可以使用-g选项,但我不确定是否可以构建一个描述密码的正则表达式,而不需要同时描述一个普通的输入:
-g, --forget-matching regexp
Forget (i.e. drop from history list) all input lines that match the POSIX 1003.2 regular expression
regexp. The match is always case-insensitive. regexp may be an ordinary string. For more about regu‐
lar expressions, see regex (7)发布于 2017-07-22 09:35:00
您可以使用rlwrap的-H选项覆盖默认历史文件。
例如alias gp='rlwrap -H /dev/null git push'
https://unix.stackexchange.com/questions/374767
复制相似问题