summaryrefslogtreecommitdiff
path: root/tests/heredoc.tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/heredoc.tests')
-rw-r--r--tests/heredoc.tests49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/heredoc.tests b/tests/heredoc.tests
index aa694965..c07ef642 100644
--- a/tests/heredoc.tests
+++ b/tests/heredoc.tests
@@ -6,6 +6,20 @@ EOF1
there
EOF2
+while read line1; do
+ read line2 <&3
+ echo $line1 - $line2
+done <<EOF1 3<<EOF2
+one
+two
+three
+EOF1
+alpha
+beta
+gamma
+EOF2
+
+
# check quoted here-doc is protected
a=foo
@@ -37,6 +51,41 @@ hi
EO\
F
+# check operation of tab removal in here documents
+cat <<- EOF
+ tab 1
+ tab 2
+ tab 3
+ EOF
+
+# check appending of text to file from here document
+rm -f /tmp/bash-zzz
+cat > /tmp/bash-zzz << EOF
+abc
+EOF
+cat >> /tmp/bash-zzz << EOF
+def ghi
+jkl mno
+EOF
+cat /tmp/bash-zzz
+rm -f /tmp/bash-zzz
+
+# make sure command printing puts the here-document as the last redirection
+# on the line, and the function export code preserves syntactic correctness
+fff()
+{
+ ed /tmp/foo <<ENDOFINPUT >/dev/null
+/^name/d
+w
+q
+ENDOFINPUT
+aa=1
+}
+
+type fff
+export -f fff
+${THIS_SH} -c 'type fff'
+
# check that end of file delimits a here-document
# THIS MUST BE LAST!