V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
pluto
V2EX  ›  Linux

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

  •  
  •   pluto · Sep 14, 2013 · 4539 views
    This topic created in 4607 days ago, the information mentioned may be changed or developed.
    看到

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

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

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

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

    最次也得把终端内容复制or截图上来吧。。。
    pluto
        2
    pluto  
    OP
       Sep 14, 2013
    问题似乎不在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
       Sep 14, 2013
    知道了,与父子shell有关系,read无法获取变量。
    LazyZhu
        4
    LazyZhu  
       Sep 14, 2013   ❤️ 1
    curl -s https://npmjs.org/install.sh > npm-install-$$.sh | sudo sh
    pluto
        5
    pluto  
    OP
       Sep 15, 2013
    不过我这种情况是子shell无法让父shell给read的变量赋值。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   825 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 20:50 · PVG 04:50 · LAX 13:50 · JFK 16:50
    ♥ Do have faith in what you're doing.