在linux中隐藏命令行的密码

时间:2015-04-22 18:07:34

标签: linux bash

对于我的bash脚本,我使用read -s来隐藏用户输入的密码。脚本运行后,我使用history命令查看是否有任何密码出现,但他们没有。后来我了解了另一种历史,即csh历史。我似乎无法弄清楚如何查看这段历史。

如果它确实出现在csh历史记录中,如何隐藏用户输入以显示我的linux框上的所有历史记录。

1 个答案:

答案 0 :(得分:1)

csh只是另一个shell,是bash的替代品。因此,只有有人真正使用它,它的历史才会重要。如果你的脚本没有在命令行上输入密码,那么从csh运行它也应该没问题。但你可以测试一下:

$ csh            <-- launches an interactive csh
$ ./script.sh    <-- run your script
<whatever>
$ history        <-- this will show you the csh history
...
$ exit           <-- drops you out of csh and back to your previous shell

因此,如果在历史中没有任何关注,那么你很好。

相关问题