V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
pluto
V2EX  ›  Linux

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

  •  
  •   pluto · 2013-09-14 20:54:20 +08:00 · 3613 次点击
    这是一个创建于 3875 天前的主题,其中的信息可能已经有所发展或是发生改变。
    看到

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

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

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

    想请教下,可能是什么情况,谢谢!
    5 条回复    1970-01-01 08:00:00 +08:00
    9hills
        1
    9hills  
       2013-09-14 21:00:01 +08:00
    表述不清,「不能执行」是什么?

    最次也得把终端内容复制or截图上来吧。。。
    pluto
        2
    pluto  
    OP
       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
        3
    pluto  
    OP
       2013-09-14 21:23:30 +08:00
    知道了,与父子shell有关系,read无法获取变量。
    LazyZhu
        4
    LazyZhu  
       2013-09-14 23:08:01 +08:00   ❤️ 1
    curl -s https://npmjs.org/install.sh > npm-install-$$.sh | sudo sh
    pluto
        5
    pluto  
    OP
       2013-09-15 00:08:31 +08:00
    不过我这种情况是子shell无法让父shell给read的变量赋值。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3882 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 226ms · UTC 10:25 · PVG 18:25 · LAX 03:25 · JFK 06:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.