[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Heredoc leading tab/space behaviour
From: |
Chet Ramey |
Subject: |
Re: Heredoc leading tab/space behaviour |
Date: |
Fri, 24 Jun 2022 09:53:58 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 |
On 6/24/22 7:53 AM, Ing. Gerold Broser via Bug reports for the GNU Bourne
Again SHell wrote:
Bash Version: 4.3
Patch Level: 48
Release Status: release
I know you're kind of at the mercy of your distro here, but this is almost
six years old, and three versions out of date. You might consider an
update.
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).
They are not, as this example shows:
$ cat x3
cat <<-SCRIPT
one
two
three
four
SCRIPT
$ ../bash-4.4-patched/bash ./x3
one
two
three
four
$ ../bash-4.4-patched/bash --version
GNU bash, version 4.4.23(8)-release (x86_64-apple-darwin15.6.0)
Copyright (C) 2016 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.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/