如何取消此配置文件中的注释行?

如何取消此配置文件中的注释行?
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

答案1

要启用partner存储库,请使用add-apt-repository工具:

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"

要删除合作伙伴存储库,请使用-r选项:

sudo add-apt-repository -r "deb http://archive.canonical.com/ $(lsb_release -sc) partner"

回答问题sources.list,您可以通过文本编辑器/实用程序进行编辑。例如:

sudo editor /etc/apt/sources.list

用于sed取消注释以 结尾的行partner

sudo sed -i '/partner$/s/^#//g' /etc/apt/sources.list

删除行首的空格:

sudo sed -i 's/^ *//' /etc/apt/sources.list

相关内容