blob: b70467df86c73487eecc2c37b6ddd4ab8e443152 [file] [log] [blame]
Denys Vlasenko77b32cc2010-09-06 11:27:32 +02001# Test for correct handling of backslashes.
2# Note that some lines in each heredoc start with a tab.
3
4a=qwerty
5
6echo Quoted heredoc:
7cat <<"EOF1"
8a\
9 b
10 123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
11 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
12c\
13EOF1
14echo
15
16echo Unquoted heredoc:
17cat <<EOF2
18a\
19 b
20 123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
21 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
22c\
23EOF2
24EOF2
25echo
26
27echo Quoted -heredoc:
28cat <<-"EOF3"
29a\
30 b
31 123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
32 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
33c\
34 EOF3
35# In -heredoc case the marker is detected even if it is indented.
36echo
37
38echo Unquoted -heredoc:
39cat <<-EOF4
40a\
41 b
42 123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
43 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
44c\
45EOF4
46 EOF4
47# The marker is not detected if preceding line ends in backslash.
48# TODO: marker should be detected even if it is split by line continuation:
49# EOF\
50# 4
51# but currently hush doesn't do it. (Tab before "4" is not allowed, though.)
52echo
53
54echo "Done: $?"