Substring Expansion doesn't respect IFS when using in Heredoc
From:
Aloxaf Yin
Subject:
Substring Expansion doesn't respect IFS when using in Heredoc
Date:
Fri, 2 Sep 2022 00:54:23 +0800
Hello, I encountered something strange when using bash. It seems like a bug
so someone suggested that I ask here.
Here is the test code.
declare -a arr=(12 34 56 78 90)
IFS=','
cat <<<"${arr[*]:0}"
cat <<EOF
${arr[*]:0}
${arr[*]}
EOF
The result is as follows. As you can see the comma is missing from the
second line.
12,34,56,78,90
12 34 56 78 90
12,34,56,78,90
bash: 5.1.16(1)-release
OS: Arch Linux