I'm trying to run this shell script in order to install RVM in an Ubuntu box
我试图运行这个shell脚本,以便在Ubuntu框中安装RVM
#!/bin/bash
RVMHTTP="https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer"
CURLARGS="-f -s -S -k"
bash < <(curl $CURLARGS $RVMHTTP)
but I get the following error
但是我得到了下面的错误
Syntax error: Redirection unexpected
语法错误:重定向意想不到的
Also tested not using the variables, but same result, could you tell what I'm missing?
也测试了不使用变量,但结果是一样的,你能告诉我遗漏了什么吗?
3 个解决方案
#1
16
#!/bin/bash
CURL='/usr/bin/curl'
RVMHTTP="https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer"
CURLARGS="-f -s -S -k"
# you can store the result in a variable
raw="$($CURL $CURLARGS $RVMHTTP)"
# or you can redirect it into a file:
$CURL $CURLARGS $RVMHTTP > /tmp/rvm-installer
or:
或者:
从URL执行bash脚本
#2
4
Firstly, your example is looking quite correct and works well on my machine. You may go another way.
首先,您的示例看起来非常正确,并且在我的机器上运行良好。你可以走另一条路。
curl $CURLARGS $RVMHTTP > ./install.sh
All output now storing in ./install.sh
file, which you can edit and execute.
所有输出现在存储在。/安装中。sh文件,您可以编辑和执行。
#3
4
url=”http://shahkrunalm.wordpress.com“
content=”$(curl -sLI “$url” | grep HTTP/1.1 | tail -1 | awk {‘print $2′})”
if [ ! -z $content ] && [ $content -eq 200 ]
then
echo “valid url”
else
echo “invalid url”
fi
#1
16
#!/bin/bash
CURL='/usr/bin/curl'
RVMHTTP="https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer"
CURLARGS="-f -s -S -k"
# you can store the result in a variable
raw="$($CURL $CURLARGS $RVMHTTP)"
# or you can redirect it into a file:
$CURL $CURLARGS $RVMHTTP > /tmp/rvm-installer
or:
或者:
从URL执行bash脚本
#2
4
Firstly, your example is looking quite correct and works well on my machine. You may go another way.
首先,您的示例看起来非常正确,并且在我的机器上运行良好。你可以走另一条路。
curl $CURLARGS $RVMHTTP > ./install.sh
All output now storing in ./install.sh
file, which you can edit and execute.
所有输出现在存储在。/安装中。sh文件,您可以编辑和执行。
#3
4
url=”http://shahkrunalm.wordpress.com“
content=”$(curl -sLI “$url” | grep HTTP/1.1 | tail -1 | awk {‘print $2′})”
if [ ! -z $content ] && [ $content -eq 200 ]
then
echo “valid url”
else
echo “invalid url”
fi