I have executed a remote Bash script bash <(curl -s URL/script.sh | tr -d '\r')
that does the following 3 actions:
- Downloads another script with a list of aliases (
aliases.sh
) to current dir. - Executes a
source ./aliases.sh
command. - Executes one of the aliases in the list after their script was sourced. This alias is
rss
, aimed to restart the webserver service.
For some reason, alias execution by the script always fails, and yet, manual execution always succeeds.
The current state is that the rss
alias (and all other aliases in he list actually) would be ignored and considered "nonexistent" when being executed by the script.sh
even though their file aliases.sh
is sourced and execution of rss
and all other aliases succeeds perfectly if I execute them manually (typing rss
and hit Enter).
Why is this "execution discrimination", so that script alias execution fails but manual alias execution succeeds?
I've reproduced this in a few different Ubuntu environments. I can't explain this and would appreciate your take on this.
shopt
command in Panther's answer). – muru Jan 22 '18 at 07:48