Hello, Configuration Information 1:
Machine: x86_64 OS: linux-gnu Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.3 -L/home/abuild/rpmbuild/BUILD/bash-4.3/../readline-6.3 Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g -Wuninitialized -Wextra -Wno-unprototyped-calls -Wno-switch-enum -Wno-unused-variable -Wno-unused-parameter -Wno-parentheses -ftree-loop-linear -pipe -DBNC382214=0 -DIMPORT_FUNCTIONS_DEF=0 -fprofile-use uname output: Linux <...host name...> 4.12.14-122.116-default #1 SMP Tue Apr 5 13:16:39 UTC 2022 (b42b08b) x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-suse-linux-gnu Bash Version: 4.3 Patch Level: 48 Release Status: release Configuration Information 2 (Win 10 Enterprise, Git Bash v2.34.1): Machine: x86_64 OS: msys Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='msys' -DCONF_MACHTYPE='x86_64-pc-msys' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS -I. -I. -I./include -I./lib -DWORDEXP_OPTION -Wno-discarded-qualifiers -march=x86-64 -mtune=generic -O2 -pipe -Wno-parentheses -Wno-format-security -D_STATIC_BUILD -g uname output: MINGW64_NT-10.0-19042 <...host name...> 3.1.7-340.x86_64 2021-10-12 16:29 UTC x86_64 Msys Machine Type: x86_64-pc-msys Bash Version: 4.4 Patch Level: 23 Release Status: release Description: The Bash Reference Manual says about Heredoc's redirection operator '<<-': "If the redirection operator is ‘<<-’, then all leading tab characters are stripped from input lines and the line containing delimiter." – https://www.gnu.org/software/bash/manual/bash.html#Here-Documents This is only half true since apparently also leading spaces are stripped from input lines (while they are not from the delimiter line, and lead to an error there). Repeat-By: ---- Note ---- Unicode characters: - blank (U+2423) for space (U+20) and - tab (U+2B73) + 7 spaces for Tab (U+9) used for clarity in the following. -------------- heredoc-error.sh: #!/bin/bash sed -f - heredoc-error.sh <<-SCRIPT ␣␣s/something/else/ ⭲ s/more/else/ ␣␣SCRIPT $ . heredoc.sh bash: warning: here-document at line 2 delimited by end-of-file (wanted `SCRIPT') sed: file - line 3: unknown command: `S' $ . heredoc-ok.sh #!/bin/bash sed -f - heredoc-ok.sh <<-SCRIPT ␣␣s/else/else/ ⭲ s/else/else/ ⭲ SCRIPT Fix: I think it'd be convenient if Heredoc supports indentation with spaces at the delimiter line, too. And, BTW, there's a mixture of (leading) backtick (U+60) and (trailing) apostrophe (U+27) at `SCRIPT' and `S' in the error message. Kind regards Gerold 'Geri' Broser