On Mon, Mar 28, 2022, at 3:06 PM, Martin Schulte wrote: > on Mon, 28 Mar 2022 20:34:40 +0200 Alex fxmbsw7 Ratchev > <fxmb...@gmail.com> wrote: >> https://pastebin.com/raw/T7ZnFapt > > Here's a somewhat stripped down version: > > $ bash --noprofile --norc -i -c "echo \$BASH_VERSION; shopt -s > expand_aliases ; source <(echo \"alias x='echo hallo'\"); alias; x" > 5.1.4(1)-release > alias x='echo hallo' > bash: x: command not found
https://www.gnu.org/software/bash/manual/html_node/Aliases.html Bash always reads at least one complete line of input, and all lines that make up a compound command, before executing any of the commands on that line or the compound command. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take effect until the next line of input is read. The commands following the alias definition on that line are not affected by the new alias. This also applies if the command defines the alias indirectly (e.g., by sourcing a second file that contains the `alias` commands). -- vq