我正在尝试编写一个脚本,该脚本将从 apt 输出可升级包的数量。然而,它也不断给我这个警告:
# sudo apt update | grep packages | cut -d '.' -f 1
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
All packages are up to date
Run Code Online (Sandbox Code Playgroud)
我希望它只输出:
All packages are up to date
Run Code Online (Sandbox Code Playgroud)
或者
35 packages can be updated
Run Code Online (Sandbox Code Playgroud)
有什么办法可以禁用该警告吗?我将在来自 cron 作业的 Discord 通知中使用这个返回的字符串以及一些额外的信息,它非常糟糕地搞乱了我的输出。
我已经看过这些,但没有一个对我有用:
https://unix.stackexchange.com/questions/19470/list-available-updates-but-do-not-install-them
https://askubuntu.com/questions/269606/apt-get-count-the-number-of-updates-available
我已经为我启用了 SSLhttps://example.com
并且工作正常,但是如果有人尝试进入,https://www.example.com
我会收到消息:您的连接不安全。
在检查 SSLcertificate 之前,有没有办法将所有 WWW 重定向到非 http?或者这是否需要在域 dns 设置上完成?