RubyMetric / chsrc

chsrc 全平台通用换源工具. Change Source for every software on every platform from the command line.
https://gitee.com/RubyMetric/chsrc
GNU General Public License v3.0
1.32k stars 54 forks source link

ubuntu换源sed命令无效 #13

Closed YiuTerran closed 9 months ago

YiuTerran commented 9 months ago

source里面本来的语句:

deb http://cn.archive.ubuntu.com/ubuntu jammy-updates main restricted

替换正则:

sed -E 's@(^[^#]* .*)http[:|\.|\/|a-z|A-Z]*\/ubuntu\/@\1https://mirrors.bfsu.edu.cn/ubuntu/@'< /etc/apt/sources.list.bak | cat > /etc/apt/sources.list

不知道你们这个正则为啥这么复杂。我是手动跑下面的语句修改的:

sed -i 's/https?:\/\/.*\/ubuntu/https:\/\/mirrors.bfsu.edu.cn\/ubuntu/g' /etc/apt/sources.list
Gchuchu commented 9 months ago

感谢您的反馈, 这主要是因为我的sed语句中对ubuntu/进行了检测,而忽略了ubuntu 另外,我写的sed语句确实十分臃肿,我们正在改进

ccmywish commented 9 months ago

@YiuTerran

感谢反馈,👍 已修复并编译好,您可使用README中的下载链接下载。

若使用无问题,可随时关闭此issue.