2011-11-29 20 views
9

sto cercando di eseguire questo script di shell per installare RVM in una casella di UbuntuCome usare arricciatura in uno script di shell?

#!/bin/bash 
RVMHTTP="https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer" 
CURLARGS="-f -s -S -k" 

bash < <(curl $CURLARGS $RVMHTTP) 

ma ottengo il seguente errore

Syntax error: Redirection unexpected

anche non testati utilizzando le variabili, ma stesso risultato , potresti dire cosa mi manca?

+0

tua domanda è stata già risposto qui: http://stackoverflow.com/questions/5735666/execute-bash-script-from-url – favoretti

+0

ho provato sul mio Mac e ha funzionato bene. Immagino che sia la bash di Ubuntu (che credo sia dash). Potresti voler controllare la pagina man per dash. –

+0

'http: // linux.die.net/man/1/dash' –

risposta

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

o:

Execute bash script from URL

4

In primo luogo, il vostro esempio è alla ricerca del tutto corretto e funziona bene sulla mia macchina. Puoi andare in un altro modo.

curl $CURLARGS $RVMHTTP > ./install.sh 

Tutto l'output ora memorizzazione in ./install.sh file, che è possibile modificare ed eseguire.

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 
Problemi correlati