521xueweihan / GitHub520

:kissing_heart: 让你“爱”上 GitHub,解决访问时图裂、加载慢的问题。(无需安装)
21.33k stars 2.15k forks source link

[docs]README 中 sed 命令行参数报错 #185

Closed edonyzpc closed 1 year ago

edonyzpc commented 1 year ago

在 BSD/MacOS 中执行 README 中的 sed 命令行时 sed -i "/# GitHub520 Host Start/Q" /etc/hosts 有如下报错:

[edony@MacBook-Pro.local ~ :57]$
>> sed -i "/# GitHub520 Host Start/Q" /etc/hosts
sed: 1: "/etc/hosts": extra characters at the end of h command

错误原因应该是: BSD/MacOS 的 sed 和 GNU sed 命令行参数不一样

README 2.3 增加 macOS/BSD sed 命令支持:

# for GNU sed (Ubuntu/CentOS/Fedora)
sed -i "/# GitHub520 Host Start/Q" /etc/hosts && curl https://raw.hellogithub.com/hosts >> /etc/hosts

# for BSD/macOS sed
sed -i "" "/# GitHub520 Host Start/,/# Github520 Host End/d" /etc/hosts && curl https://raw.hellogithub.com/hosts >> /etc/hosts
521xueweihan commented 1 year ago

@edonyzpc 感谢贡献,已更新。