Execute bash script from URL Execute bash script from URL bash bash

Execute bash script from URL


source <(curl -s http://mywebsite.com/myscript.txt)

ought to do it. Alternately, leave off the initial redirection on yours, which is redirecting standard input; bash takes a filename to execute just fine without redirection, and <(command) syntax provides a path.

bash <(curl -s http://mywebsite.com/myscript.txt)

It may be clearer if you look at the output of echo <(cat /dev/null)


This is the way to execute remote script with passing to it some arguments (arg1 arg2):

curl -s http://server/path/script.sh | bash /dev/stdin arg1 arg2


For bash, Bourne shell and fish:

curl -s http://server/path/script.sh | bash -s arg1 arg2

Flag "-s" makes shell read from stdin.