sed 不支持非贪婪匹配 改用 perl
问题
之前 Free.vps.vc 访问
实践:
bash <(curl -L https://github.crazypeace.workers.dev/https://github.com/crazypeace/v2ray_wss/raw/main/install.sh | sed -E "$(curl -L https://github.crazypeace.workers.dev/https://github.com/crazypeace/gh-proxy/raw/master/sed-E-para)")
发现这个处理方法并不完美。
用
curl -L https://github.crazypeace.workers.dev/https://github.com/crazypeace/v2ray_wss/raw/main/install.sh | sed -E "$(curl -L https://github.crazypeace.workers.dev/https://github.com/crazypeace/gh-proxy/raw/master/sed-E-para)" | grep github
发现,.sh 的部分,
bash <(curl -L https://github.crazypeace.workers.dev/https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh | sed -E "$(curl -L https://github.com/crazypeace/gh-proxy/raw/master/sed-E-para)" ) --version 4.45.2
只在前面加了 github proxy,后面调用 GitHub 资源的部分并没有处理。
分析
查了一下资料发现,sed
实操
perl
如
perl -pe 's#(http.*github[^/]*/)#https://github.crazypeace.workers.dev/\1#g'
同样支持 ; 分隔多个 s 命令
不过要注意,
perl
perl
最终结果
https://github.com/crazypeace/gh-proxy/blob/master/perl-pe-para 的内容为
s#(curl.*?\.sh)([^/])#\1 | perl -pe "\$(curl -L https://github.com/crazypeace/gh-proxy/raw/master/perl-pe-para)" \2#g; s#(http.*?github[^/]*?/)#https://github.crazypeace.workers.dev/\1#g
bash <(curl -L https://github.com/crazypeace/v2ray_wss/raw/main/install.sh)
bash <(curl -L https://github.crazypeace.workers.dev/https://github.com/crazypeace/v2ray_wss/raw/main/install.sh | perl -pe "$(curl -L https://github.crazypeace.workers.dev/https://github.com/crazypeace/gh-proxy/raw/master/perl-pe-para)")
感谢
fscarmen https://t.me/fscarmen2
评论
发表评论