提问人:DiogoSaraiva 提问时间:2/22/2015 最后编辑:gniourf_gniourfDiogoSaraiva 更新时间:2/22/2015 访问量:238
缩短的链接。如何卷曲它们?并执行 bash
Shortened links. How to curl them? and execute bash
问:
在这个链接 http://goo.gl/3WQR9M,我有一些示例shell脚本代码,我想知道如何将其工作:
bash <(curl -s http://goo.gl/3WQR9M)
这而不是卷曲完整的链接:
(https://gist.githubusercontent.com/DiogoSaraiva/b3a1ee49a049a152cfaf/raw/a2e5329ed4f9dee964ee2fe0d25d5967b7714d76/upgrade.sh):
用这个:
#!/bin/bash
echo -e "###> UPGRADE <###\n"
apt-get upgrade -y
sleep 3
echo -e "\n\n"
echo -e "###> DIST-UPGRADE <###\n"
apt-get dist-upgrade -y
sleep 3
echo -e "\n\n"
echo -e "###> AUTOREMOVE <###\n"
apt-get auto remove
只需输出以下内容:
<HTML>
<HEAD>
<TITLE>Moved Permanently</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Permanently</H1>
The document has moved <A HREF="https://gist.githubusercontent.com/DiogoSaraiva/b3a1ee49a049a152cfaf/raw/a2e5329ed4f9dee964ee2fe0d25d5967b7714d76/upgrade.sh">here</A>.
</BODY>
</HTML>
是否有任何 --option 可以卷曲 https://gist.githubusercontent.com/DiogoSaraiva/b3a1ee49a049a152cfaf/raw/a2e5329ed4f9dee964ee2fe0d25d5967b7714d76/upgrade.sh 而不是 http://goo.gl/3WQR9M ,但使用小选项(例如:卷曲 http://goo.gl/3WQR9M )
我需要的是:
上传到我的脚本的某个地方;DONE
获取 RAW 的 URL?文件;DONE
:在一个小命令中,执行 Internet 中的 shell 脚本;如何?
答:
2赞
Tristan
2/22/2015
#1
使用 curl -L 选项跟随 Location 标头。然后,您可以使用以下 shell 命令:
curl -sSL http://goo.gl/3WQR9 | sudo sh
评论
-L
curl -sL http://goo.gl/3WQR9M | bash
-s
bash
curl -sL http://blahblah | bash -s arg1 arg2 arg3 ...