Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux etienne-7950x 6.2.0-34-generic #34~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 13:12:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.1 Patch Level: 16 Release Status: release Description: simple unmodified cut&paste of a session: etienne@etienne-7950x:~$ /bin/bash --version GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. etienne@etienne-7950x:~$ /bin/bash etienne@etienne-7950x:~$ echo ${HOME}:/home/${USER} bash: ${HOME}:/home/${USER}: bad substitution etienne@etienne-7950x:~$ echo ${HOME} bash: ${HOME}: bad substitution etienne@etienne-7950x:~$ echo $HOME /home/etienne etienne@etienne-7950x:~$ echo ${HOME} bash: ${HOME}: bad substitution etienne@etienne-7950x:~$ exit etienne@etienne-7950x:~$ /bin/bash etienne@etienne-7950x:~$ echo ${HOME} bash: ${HOME}: bad substitution etienne@etienne-7950x:~$ exit etienne@etienne-7950x:~$ /bin/bash -l etienne@etienne-7950x:~$ echo ${HOME} bash: ${HOME}: bad substitution etienne@etienne-7950x:~$ But sometimes it does work, cut&paste of another session: etienne@etienne-7950x:~$ /bin/bash --version GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. etienne@etienne-7950x:~$ /bin/bash etienne@etienne-7950x:~$ echo $HOME /home/etienne etienne@etienne-7950x:~$ echo ${HOME} /home/etienne etienne@etienne-7950x:~$ exit Is there some kind of optimisation problem, and ${HOME} is treated as ${/home/etienne} where obviously the error message "bad substitution" makes sense? Is that often triggered by the line "echo ${HOME}:/home/${USER}", double ${} on two different variables, but not always? Repeat-By: Sometimes I get the first behaviour (error message), sometimes the second correct behaviour (no difference in between $HOME and ${HOME}) The host is "AMD Ryzen 9 7950X 16-Core Processor" on Ubuntu 22.04.3 LTS (fully updated and fresh reboot this morning) and does not behaves incorrectly othewise, multiple hours compilations without any problems.