Shell – Source (.) piped curl output

curlenvironment-variablesshell

I have a file, f, on my webserver with the following contents:

alias ll='ls -l'

I would like to (from another linux box) do the following, but I can't get the command right:

curl http://myserver/f | ?

Where the ? will read each line into the current environment. So, given the above file, this would have the same effect as doing

% alias ll='ls -l'

in the current shell process. Is this possible?

Best Answer

How about using eval "$(curl "$URL")"?

But you better be really sure you get the right URL, and the downloaded code doesn't do anything nasty.

Related Question