For the follow script alias al=' ' alias foo=bar al for foo in v do echo foo=$foo bar=$bar done bash (version 5.1.16) prints foo=v bar=, while all other shells I tested (dash, ksh, zsh, and yash) all prints foo= bar=v. Apparently bash substitutes foo for bar in line 3 because the previous alias al ends with a space. But it is unintuitive that the word after for is checked for alias. According to the posix standard, If the value of the alias replacing the word ends in a <blank>, the shell shall check the next command word for alias substitution; this process shall continue until a word is found that is not a valid alias or an alias value does not end in a <blank>. But “command word” is not defined. It is ambiguous whether “for” in this context is a command word, or whether tokens other than command word is allowed between the first alias and the next command word.
The same is true for case alias al=' ' alias foo=bar al case foo in foo) echo foo;; bar) echo bar;; esac