[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

temp setting POSIXLY_CORRECT turns alias expansion off

From: Martijn Dekker
Subject: temp setting POSIXLY_CORRECT turns alias expansion off
Date: Thu, 16 Jan 2020 04:24:40 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]