Piping a shell script to bash and launch interactive bash

bash, curl, linux, shell

Solution

You can `source` it:

# open a shell
. <(curl http://example.com/hello_scope.sh)
# type commands ...

Problem

Consider the following shell script on example.com ``` #/bin/bash export HELLO_SCOPE=WORLD eval $@ ``` Now, I would like to download and then execute this shell script with parameters in the simplest way and be able to launch an interactive bash terminal with the HELLO_SCOPE variable set. I have tried ``` curl http://example.com/hello_scope.sh | bash -s bash -i ``` But it quits the shell immediately. From what I can understand, it's because curls `stdout`, the script, remains the `stdin` of the bash, preventing it from starting interactively (as that would require my keyboard to be `stdin`). Is there a way to avoid this without going through the extra step of creating a temporary file with the shell script?

Original source