想用curl直接获取github上的脚本然后执行但却不行

2013-09-14 20:54:20 +08:00
 pluto
看到

curl https://npmjs.org/install.sh | sh

是可以执行的,然后我自己也弄了一个放在 github 上,但却不能执行:

curl https://raw.github.com/plutoid/Pluto-s-Airport/master/dualwire.sh | bash

想请教下,可能是什么情况,谢谢!
3665 次点击
所在节点    Linux
5 条回复
9hills
2013-09-14 21:00:01 +08:00
表述不清,「不能执行」是什么?

最次也得把终端内容复制or截图上来吧。。。
pluto
2013-09-14 21:06:30 +08:00
问题似乎不在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 变量了。
pluto
2013-09-14 21:23:30 +08:00
知道了,与父子shell有关系,read无法获取变量。
LazyZhu
2013-09-14 23:08:01 +08:00
curl -s https://npmjs.org/install.sh > npm-install-$$.sh | sudo sh
pluto
2013-09-15 00:08:31 +08:00
不过我这种情况是子shell无法让父shell给read的变量赋值。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/82466

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX