![为什么 apt-get 输出突然变成彩色的?](https://linux22.com/image/225388/%E4%B8%BA%E4%BB%80%E4%B9%88%20apt-get%20%E8%BE%93%E5%87%BA%E7%AA%81%E7%84%B6%E5%8F%98%E6%88%90%E5%BD%A9%E8%89%B2%E7%9A%84%EF%BC%9F.png)
我正想办法去买酒。我一直在做指示https://wiki.winehq.org/Ubuntu我sudo apt update
看到“E:存储库'cdrom ...”带有红色“E”。就在几分钟前,sudo apt update
它的输出是普通的白色,与其他输出相同。在“正常”和红色之间,我执行的唯一命令是下载未安装的命令sudo apt-get install -d somepackage
和从 wine 页面下载的命令。
我想重新审视/重新检查我所做的事情,现在只有在输出history
之后才再次变为全白色。cat /etc/apt/sources.list.d/winehq-jammy.sources
sudo apt update
知道发生了什么吗?是什么导致出现彩色输出?我对我使用的系统出现故障很警惕,我想找出原因。在网上搜索 apt 的彩色输出发现了一些涉及脚本等的解决方案,添加源和密钥如何导致瞬态颜色?
长话短说
找到的链接:
https://askubuntu.com/questions/445245/how-do-i-enable-fancy-apt-colours-and-progress-bars
终端内容(实际上比我之前提到的更多命令,仍然不知道如何产生颜色):
35 sudo apt-get update
36 sudo apt-get install -d somepackage
37 eval $(apt-config shell CACHE Dir::Cache)
38 eval $(apt-config shell ARCHIVES Dir::Cache::archives)
39 # from man bash:
40 # brace { after $ "serve to protect the variable to be expanded from characters immediately following it which could be interpreted as part of the name."
41 debs_cache_folder=/${CACHE}/${ARCHIVES}
42 echo $debs_cache_folder
43 ls `echo $debs_cache_folder`
44 ls `echo $debs_cache_folder` | wc
45 sudo apt-get clean
... same install -d / ls wc / clean for several other packages
54 sudo dpkg --add-architecture i386
55 sudo mkdir -pm755 /etc/apt/keyrings
56 sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
57 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
58 sudo apt update
59 history
~/Downloads$ cat /etc/apt/sources.list.d/
cat: /etc/apt/sources.list.d/: Is a directory
~/Downloads$ cat /etc/apt/sources.list.d/
official-package-repositories.list winehq-jammy.sources
~/Downloads$ cat /etc/apt/sources.list.d/winehq-jammy.sources
Types: deb
URIs: https://dl.winehq.org/wine-builds/ubuntu
Suites: jammy
Components: main
Architectures: amd64 i386
Signed-By: /etc/apt/keyrings/winehq-archive.key