在bash中丢弃错误和输出

时间:2023-01-30 13:57:45

I am trying to write a password cracker for cracking password locked pdf. I have 4 for loops too iterate through all the possible 4 char passwords. I have a command that gives out error messages if the password is wrong. presently i redirect the error and output to a temporary file and delete the file after every check. This consumes a lot of time and is making the script slower. If anyone could suggest me a better idea or redirection that would be helpful.

我正在尝试编写密码破解程序来破解密码锁定的pdf。我有4个for循环也遍历所有可能的4个char密码。如果密码错误,我有一个命令可以发出错误消息。目前我将错误重定向并输出到临时文件,并在每次检查后删除该文件。这会消耗大量时间并使脚本变慢。如果有人可以建议我一个更好的主意或重定向,这将是有帮助的。

Thanks in Advance Harsha

在此先感谢Harsha

1 个解决方案

#1


1  

You can do like this:

你可以这样做:

command > /dev/null 2>&1

To redirect stdout and stderr to /dev/null thus discarding the standard output and standard error completely.

将stdout和stderr重定向到/ dev / null,从而完全丢弃标准输出和标准错误。

#1


1  

You can do like this:

你可以这样做:

command > /dev/null 2>&1

To redirect stdout and stderr to /dev/null thus discarding the standard output and standard error completely.

将stdout和stderr重定向到/ dev / null,从而完全丢弃标准输出和标准错误。

相关文章