[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
heredoc whose eof-mark has backquotes becomes quoted
From: |
Denys Vlasenko |
Subject: |
heredoc whose eof-mark has backquotes becomes quoted |
Date: |
Fri, 6 Apr 2018 14:32:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
Background:
Unquoted heredocs are this construct
cat <<EOF
heredoc will expand $var, `cmd` etc
EOF
Quoted heredocs are this construct:
cat <<"EOF"
these chars are literals: $ `
EOF
"Quoteness" also can be achieved by bkslash
or single quotes: EO\F 'EOF' EOF"" ''EOF
The bug: if there are backquotes in eof-mark,
they become the part of eof-makr (this is ok), but they also
make this heredoc _quoted_, which should not happen:
cat <<EO`true`F
heredoc1
EO`false`F
EO`true`F
echo Ok:$?
Output of bash-4.3.43:
$ bash z
heredoc1
EO`false`F
Ok:0
Should be:
heredoc1
EOF
Ok:0
- heredoc whose eof-mark has backquotes becomes quoted,
Denys Vlasenko <=