]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/heredoc3.sub
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / heredoc3.sub
CommitLineData
8868edaf
CR
1# This program is free software: you can redistribute it and/or modify
2# it under the terms of the GNU General Public License as published by
3# the Free Software Foundation, either version 3 of the License, or
4# (at your option) any later version.
5#
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY; without even the implied warranty of
8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9# GNU General Public License for more details.
10#
11# You should have received a copy of the GNU General Public License
12# along with this program. If not, see <http://www.gnu.org/licenses/>.
13#
a0c0a00f 14SAVEPWD=$PWD
d233b485 15: ${TMPDIR:=/tmp}
a0c0a00f
CR
16cd $TMPDIR || echo "heredoc3.sub: cannot cd to $TMPDIR" >&2
17
ac50fbac
CR
18text=$(cat <<EOF
19here is the text
20EOF)
21
22echo = $text =
23
24unbalanced=$(cat <<EOF
25this paren ) is not a problem
26EOF)
27
28echo $unbalanced
29
30balanced=$(cat <<EOF
31these balanced parens ( ) are not a problem
32EOF)
33
34echo $balanced
35
36balanced=$(cat <<EOF
37quoted balanced parens \( ) are not a problem either
38EOF)
39
40echo $balanced
41
42(cat <<EOF
43more text in a subshell
44EOF
45)
46
47(cat <<EOF; )
48some more text in a different subshell
49EOF
50echo end
51
52# semi-weird examples posted by Wayne Pollack to austin-group mailing list
53cat <<-' END'
54 hello
55 END
56
57cat <<END
58hello
59END\
60END
61END
62echo end ENDEND
63
64cat <<' END '
65hello
66 END
67echo end hello
68
a0c0a00f 69cat <<x*x >/dev/null & touch 'x*x'
ac50fbac
CR
70x star x
71x*x
a0c0a00f 72wait $!
ac50fbac
CR
73echo end 'x*x'
74rm 'x*x'
75
76cat <<END
77hello\
78END
79END
80echo end helloEND
81
82cat <<END
83hello
84\END
85END
d233b485
CR
86echo -E end 'hello<NL>\END'
87
88# gprof
89if [ -n "$GMON_OUT_PREFIX" ]; then
90 mv ${GMON_OUT_PREFIX}.[0-9]* "$SAVEPWD" >/dev/null 2>&1
91fi
92cd "$SAVEPWD"
ac50fbac
CR
93
94# this has to be last -- results in a syntax error
95# doesn't currently parse because EOF is not on a line by itself -- should it?
96(cat <<EOF
97still more text in a subshell
98EOF)