想用curl直接获取github上的脚本然后执行但却不行
- 0次
- 2021-07-21 07:51:22
- idczone
看到
curl https://npmjs.org/install.sh | sh
是可以执行的,然后我自己也弄了一个放在 github 上,但却不能执行:
curl https://raw.github.com/plutoid/Pluto-s-Airport/master/dualwire.sh | bash
想请教下,可能是什么情况,谢谢!
表述不清,「不能执行」是什么?
最次也得把终端内容复制or截图上来吧。。。
问题似乎不在curl上,如果直接
cat /tmp/test.sh|bash
Ok, u r root.Let's going on.
Check linux distro version...
Pls mannual enter eth info:
ct ip addr : cnc ip addr : ct eth alias : cnc eth alias : ct route : cnc route : Pls verify the ethernet info and input [yes/no] then enter.
就是脚本里有 read 变量的地方,通过管道就自动忽略然后结束了,问题变成管道后无法 read 变量了。
知道了,与父子shell有关系,read无法获取变量。
curl -s https://npmjs.org/install.sh > npm-install-$$.sh | sudo sh
不过我这种情况是子shell无法让父shell给read的变量赋值。。。