On Sat, May 24, 2025 at 15:00:21 -0500, Bob Mroczka wrote: > #!/bin/bash > set -o pipefail > shopt -s expand_aliases > alias ub='echo hi' > echo "alias ub='echo bye'" >~/.alias > cat ~/.alias > source ~/.alias && ub > ub
I believe you've run into the issue described in this paragraph of the man page: The rules concerning the definition and use of aliases are somewhat confusing. 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.