-2

This question already has an answer here:

Using curl as in:

bash <(curl -s https://raw.githubusercontent.com/user/repo/master/script.sh | tr -d '\r')

I executed some remote script.

The remote script includes the following two aspects:

1) The command:

wget -P ~/myAddons/ https://raw.githubusercontent.com/user/repo/master/appendix.sh

2) a source ~/myAddons/appendix.sh command:

This file appendix.sh, includes some Bash aliases.


The problem

After executing the remote script, I tried to use some aliases from appendix.sh. None worked.

Only after manually executing source ~/myAddons/appendix.sh, the aliases worked.

  • I checked at least 3 times that both the remote script's source command, and the manual command, are the same.

The question

Why did the execution of source ~/myAddons/appendix.sh directly from the remote script, fail, while the manually it worked, and what's the right way to cope with that?

marked as duplicate by Michael Homer, muru, G-Man, LinuxSecurityFreak, Jeff Schaller Jan 28 '18 at 13:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1) Where is curl? 2) I think you've missed a phase of running it, or else missed some explanation about it. – Michael Homer Jan 28 '18 at 4:11
  • 4
    You're starting a new shell with bash <(...) and then sourcing within it. That won't affect the original shell from which you ran bash <(...). – muru Jan 28 '18 at 5:08
  • @muru this could be great as an answer here because it really answered my question. – pntshere Jan 28 '18 at 7:50
1

You're starting a new shell with bash <(...) and then sourcing within it. That won't affect the original shell from which you ran bash <(...). You should source the process substitution instead:

source <(...)
# or
. <(...)

Not the answer you're looking for? Browse other questions tagged or ask your own question.