-2

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?

  • 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 05:08
  • @muru this could be great as an answer here because it really answered my question. – Arcticooling Jan 28 '18 at 07:50