When alias expansion is enabled for a script in bash native mode, prefixing POSIXLY_CORRECT=y to any command will turn alias expansion globally off. This is a bug because the assignment should only have effect on that command.

$ bash -c 'shopt -s expand_aliases; shopt|grep expand_a;
  POSIXLY_CORRECT=y true; shopt|grep expand_a'
expand_aliases  on
expand_aliases  off

Expected behaviour: alias expansion should stay on.

I've confirmed this bug on bash 4.2 and later; bash 4.1 and earlier seem fine.

- M.

--
modernish -- harness the shell
https://github.com/modernish/modernish

Reply via email to