]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/heredoc3.sub
bash-5.0 distribution sources and documentation
[thirdparty/bash.git] / tests / heredoc3.sub
CommitLineData
a0c0a00f 1SAVEPWD=$PWD
d233b485 2: ${TMPDIR:=/tmp}
a0c0a00f
CR
3cd $TMPDIR || echo "heredoc3.sub: cannot cd to $TMPDIR" >&2
4
ac50fbac
CR
5text=$(cat <<EOF
6here is the text
7EOF)
8
9echo = $text =
10
11unbalanced=$(cat <<EOF
12this paren ) is not a problem
13EOF)
14
15echo $unbalanced
16
17balanced=$(cat <<EOF
18these balanced parens ( ) are not a problem
19EOF)
20
21echo $balanced
22
23balanced=$(cat <<EOF
24quoted balanced parens \( ) are not a problem either
25EOF)
26
27echo $balanced
28
29(cat <<EOF
30more text in a subshell
31EOF
32)
33
34(cat <<EOF; )
35some more text in a different subshell
36EOF
37echo end
38
39# semi-weird examples posted by Wayne Pollack to austin-group mailing list
40cat <<-' END'
41 hello
42 END
43
44cat <<END
45hello
46END\
47END
48END
49echo end ENDEND
50
51cat <<' END '
52hello
53 END
54echo end hello
55
a0c0a00f 56cat <<x*x >/dev/null & touch 'x*x'
ac50fbac
CR
57x star x
58x*x
a0c0a00f 59wait $!
ac50fbac
CR
60echo end 'x*x'
61rm 'x*x'
62
63cat <<END
64hello\
65END
66END
67echo end helloEND
68
69cat <<END
70hello
71\END
72END
d233b485
CR
73echo -E end 'hello<NL>\END'
74
75# gprof
76if [ -n "$GMON_OUT_PREFIX" ]; then
77 mv ${GMON_OUT_PREFIX}.[0-9]* "$SAVEPWD" >/dev/null 2>&1
78fi
79cd "$SAVEPWD"
ac50fbac
CR
80
81# this has to be last -- results in a syntax error
82# doesn't currently parse because EOF is not on a line by itself -- should it?
83(cat <<EOF
84still more text in a subshell
85EOF)