28

I'm trying to run this shell script in order to install RVM in an Ubuntu box

#!/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?

4
  • Your question has been already answered here: stackoverflow.com/questions/5735666/… Commented Nov 29, 2011 at 22:33
  • I tried it on my mac and it worked fine. I guess it's Ubuntu's bash (which I believe is dash). You might want to check the man page for dash. Commented Nov 29, 2011 at 22:37
  • http://linux.die.net/man/1/dash Commented Nov 29, 2011 at 22:45
  • If you get "redirection unexpected" it probably means you were using sh instead of bash, in spite of the shebang line. Commented Mar 23, 2021 at 7:55

3 Answers 3

26
#!/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:

Execute bash script from URL

Sign up to request clarification or add additional context in comments.

Comments

6
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

Comments

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.