summaryrefslogtreecommitdiff
path: root/tests/read.tests
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1996-12-23 17:02:34 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:49 +0000
commitccc6cda312fea9f0468ee65b8f368e9653e1380b (patch)
treeb059878adcfd876c4acb8030deda1eeb918c7e75 /tests/read.tests
parent726f63884db0132f01745f1fb4465e6621088ccf (diff)
downloadbash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.tar.gz
Imported from ../bash-2.0.tar.gz.
Diffstat (limited to 'tests/read.tests')
-rw-r--r--tests/read.tests24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/read.tests b/tests/read.tests
new file mode 100644
index 00000000..ad814d6d
--- /dev/null
+++ b/tests/read.tests
@@ -0,0 +1,24 @@
+echo " a " | (read x; echo "$x.")
+
+echo " a b " | ( read x y ; echo -"$x"-"$y"- )
+echo " a b\ " | ( read x y ; echo -"$x"-"$y"- )
+echo " a b " | ( read x ; echo -"$x"- )
+echo " a b\ " | ( read x ; echo -"$x"- )
+
+echo " a b\ " | ( read -r x y ; echo -"$x"-"$y"- )
+echo " a b\ " | ( read -r x ; echo -"$x"- )
+
+echo "\ a b\ " | ( read -r x y ; echo -"$x"-"$y"- )
+echo "\ a b\ " | ( read -r x ; echo -"$x"- )
+echo " \ a b\ " | ( read -r x y ; echo -"$x"-"$y"- )
+echo " \ a b\ " | ( read -r x ; echo -"$x"- )
+
+echo "A B " > /tmp/IN
+unset x y z
+read x y z < /tmp/IN
+echo 1: "x[$x] y[$y] z[$z]"
+echo 1a: ${z-z not set}
+read x < /tmp/IN
+echo 2: "x[$x]"
+rm /tmp/IN
+