Skip to main content
1 of 2
Hauke Laging
  • 94.6k
  • 21
  • 132
  • 185

There is not enough code in the question to be sure but this might be the problem, man bash:

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.

So make sure your code is like this:

alias cmd1='echo foo'
alias cmd2='echo bar'
cmd1 ; cmd2
Hauke Laging
  • 94.6k
  • 21
  • 132
  • 185