New alias not available after ;

The alias syntax you are using is inappropriate for a POSIX shell, for a POSIX shell, you need to use:

alias name='replacement'

But for all shells, this cannot work as the alias replacement is done early in the parser.

Before your alias setup is executed, the whole line was read by the parser and for this reason, your command line wil not work.

If the alias appears on the next command line, it will work.


This behavior is intended and specified by POSIX under Alias Substitution.

An alias was substituted right after the shell perform Token Recognition and before any Grammar Rules applied. At the time you called the alias <name>, the command alias wasn't executed.

Tags:

Shell

Alias