[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $(<...) fails with nested quoting.
From: |
|
Subject: |
Re: $(<...) fails with nested quoting. |
Date: |
Mon, 17 Aug 2020 14:20:49 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.1.1 |
On 17/08/2020 04:03, Steven McBride wrote:
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib
-Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/build/bash-N2nMjo/bash-4.4.18=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux tau5vbub1 4.15.0-112-generic #113-Ubuntu SMP Thu Jul
9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.4
Patch Level: 20
Release Status: release
Description:
'echo "$(<\"filename\")"' fails with No such file or directory
error.
'echo "$(cat \"filename\")"' also fails no such file or directory
error.
'echo "$(<filename)"' is okay.
'echo $(<"filename")' is okay.
I think I'm doing the nested double quoting correctly.
Only in the last case. There is no bug here.
The quoting is because in my original case 'filename' was
a variable that could contained a filename with spaces in it.
"$(<"$filename")"
For an explanation, see https://mywiki.wooledge.org/CommandSubstitution.
--
Kerin Millar