我正在尝试将 find 命令的输出发送到 OpenSSL,以了解证书何时过期。
这会找到文件
find . -name \*.pem -type f
这会生成我想要的证书信息
openssl x509 -in certname.pem -noout -enddate
我可以合并这两个吗?
谢谢你的帮助。
我正在尝试将 find 命令的输出发送到 OpenSSL,以了解证书何时过期。
这会找到文件
find . -name \*.pem -type f
这会生成我想要的证书信息
openssl x509 -in certname.pem -noout -enddate
我可以合并这两个吗?
谢谢你的帮助。
find . -name \*.pem -type f -execdir openssl x509 -in {} -noout -enddate \;
就像对 find 的一般评论一样:如果您获取 find 的输出并将其通过管道传输到 xargs 并让它运行命令,您的命令将运行得更快。问题是 find 会为每个匹配的文件生成一个新命令,这非常慢,但是如果您可以将多个参数传递给同一个命令(就像 xargs 一样),您可以保存所有这些 fork 和上下文切换。它与 grep 之类的命令配合得非常好。