sudo dmidecode | grep State 2> /dev/null
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Invalid entry length (16). Fixed up to 11
我不想在输出中出现 Invalid entry 错误。我该如何过滤?
sudo dmidecode | grep State 2> /dev/null
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Invalid entry length (16). Fixed up to 11
我不想在输出中出现 Invalid entry 错误。我该如何过滤?
正如 Wildcard 评论的那样,您错误地重定向了 grep 的 stderr 而不是 sudo/dmidecode 的。改用这个: