小智 37
如果您放入HISTCONTROL=ignorespace
.bashrc 并在命令名称前放置一个空格,则不会将其添加到您的历史记录中。
$ export HISTCONTROL=ignorespace
$ grep "passwd" secret_password_file.txt # added to history
$ grep "passwd" secret_password_file.txt # not added to history
Run Code Online (Sandbox Code Playgroud)
为了完整起见,我在正文中回答了这个问题:如何让 grep 从标准输入读取模式:
您可以使用以下-f
选项:
grep -f- /path/to/file
Run Code Online (Sandbox Code Playgroud)
这将从 中读取任意数量的模式stdin
,每行一个。(-
意味着stdin
;您还可以指定一个带有模式的文件,每行一个。)grep
将匹配/path/to/file
与任何指定模式匹配的行。
归档时间: |
|
查看次数: |
1376 次 |
最近记录: |