[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple use of HOME with ${} instead of single $ sometimes doen't wor
From: |
Kerin Millar |
Subject: |
Re: Simple use of HOME with ${} instead of single $ sometimes doen't work... Ubuntu 22.04.3 LTS |
Date: |
Fri, 20 Oct 2023 14:23:19 +0100 |
On Fri, 20 Oct 2023 09:41:26 +0000 (UTC)
Etienne Lorrain via Bug reports for the GNU Bourne Again SHell
<bug-bash@gnu.org> wrote:
> 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
The above commands are chock full of ZERO-WIDTH SPACE characters, encoded as
UTF-8.
00000000 65 63 68 6f 20 24 7b e2 80 8b e2 80 8b e2 80 8b |echo ${.........|
00000010 e2 80 8b e2 80 8b e2 80 8b e2 80 8b 48 4f 4d 45 |............HOME|
00000020 7d e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8b |}...............|
00000030 e2 80 8b e2 80 8b 0a |.......|
00000037
Bash prints these non-printing characters within the diagnostic message exactly
as they are, making the fact harder to diagnose. Nevertheless, it is quite
correct in pointing out that it is a bad substitution.
--
Kerin Millar