ive had many inconsistency with bash this regarding exoerienced On Wed, Feb 2, 2022, 15:00 L A Walsh <b...@tlinx.org> wrote:
> On 2022/01/31 20:40, Martijn Dekker wrote: > > On the latest code from the devel branch: > > GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) > > > > Reproducer script: > > > > shopt -s expand_aliases > > alias let='let --' > > set -x > > let '1 == 1' > > : $(let '1 == 1') > > > > Output: > > > > + let -- '1 == 1' > > ++ let -- -- '1 == 1' > > foo: line 5: let: --: syntax error: operand expected (error token is "-") > > + : > > > > The alias is incorrectly expanded in the command substitution, > > duplicating the '--' argument and causing a syntax error. > > > ---- > I can't say for sure, but it would be interesting if anyone else > has this result in a bash with aliases on by default: > > I.e. My bash is posix compliant by default w/r/t aliases: > > env -i /bin/bash --noprofile --norc > bash-4.4$ shopt -p expand_aliases > shopt -s expand_aliases > > and it doesn't show the above error: > > bash-4.4$ alias let='let --' > bash-4.4$ set -x > bash-4.4$ let '1 == 1' > + let -- '1 == 1' > bash-4.4$ : $(let '1 == 1') > ++ let -- '1 == 1' > + : > > It may not be the case, but to me, looked like the alias for 'let' had > been disabled > in the $() subshell as per standard bash behavior of disabling aliases > on startup. > > I.e. if you configure bash to be posix compliant w/r/t aliases on > shell startup, this seems to fix the above problem. > > > > > >