我想重定向错误
python: can't open file '/usr/bin/file': [Errno 2] No such file or directory
我用这个命令
python /usr/bin/file 2> /dev/zero
但这将所有输出隐藏在我的文件中,因此我只想重定向未找到的错误,而别无其他。
二进制文件是我通过python给我编写的脚本
Enter your password:
Welcome User :)
Checking your Secure Code now ...
Secure Code OK , Enjoy !!
What is the folder path ? ### This is hidden when used the code ###
最佳答案
您需要/dev/null
而不是/dev/zero
,它是脚本的生成器(如果需要,可以读取零字节的无尽流)。
实际上,您显示的语法仅重定向标准错误。如果标准输出丢失,那是因为其他原因。
关于bash - Bash脚本,错误输出重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26644694/