bash - openssl:如何在控制台中禁用 "writing RSA key"消息

标签 bash shell openssl

有什么方法可以禁用控制台消息“写入 RSA key ”?

$ openssl rsa -pubout -outform DER -inform PEM -in /tmp/res/chrome.pem -out 1 > /dev/null 
writing RSA key
$ openssl rsa -pubout -outform DER -inform PEM -in /tmp/res/chrome.pem -out 1
writing RSA key
$ openssl rsa -pubout -outform DER -inform PEM -in /tmp/res/chrome.pem > /dev/null
writing RSA key

我尝试了这些命令,结果相同:(

最佳答案

使用 strace 运行命令显示消息被写入 STDERR:

write(<b>2</b>, "writing RSA key\n", 16)       = 16
      ^

所以你必须重定向 STDERR 而不是 STDOUT:

openssl rsa -pubout ... 2>/dev/null

关于bash - openssl:如何在控制台中禁用 "writing RSA key"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16608154/

相关文章:

java - 如何将密码添加到 Java 中的现有私钥

PHP:openssl_random_pseudo_bytes() 和加密安全与极端随机性

python - 使用 xvkbd 读取条形码。如何禁用Enter键?

linux - 比较使用变量时 Awk 在 bash 脚本中不工作

wordpress - wordpress 网站的 SSL 证书

linux - 从文件中提取 shell 脚本中一行的子字符串

linux - 如何sudo通过ssh运行本地脚本

bash 两个字符串的最长公共(public)部分

bash - LFTP 未知命令 `;'

shell - GNU screen : How can I create a screen in the background if it doesn't exist?