[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
aliases sometimes not expanded even with expand_aliases set
From: |
ian |
Subject: |
aliases sometimes not expanded even with expand_aliases set |
Date: |
Sun, 13 Oct 2024 00:01:10 +1030 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64
-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
-fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
uname output: Linux sibyl.beware.dropbear.id.au 6.10.10-200.fc40.x86_64 #1 SMP
PREEMPT_DYNAMIC Thu Sep 12 18:26:09 UTC 2024 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
Bash Version: 5.2
Patch Level: 26
Release Status: release
Description:
In the following script, the first alias fails with "comand not found"
but the second works.
#!/bin/bash
shopt -s expand_aliases
if :; then
alias foo='echo'
foo x y z
shopt expand_aliases
alias -p
fi
alias foo='echo'
foo a b c
Running it produces:
$ ./alias-test.sh
./alias-test.sh: line 7: foo: command not found
expand_aliases on
alias foo='echo'
a b c
This is at least, undocumented behaviour.
Repeat-By:
Run the script in "Description".
- aliases sometimes not expanded even with expand_aliases set,
ian <=