diff options
Diffstat (limited to 'tests/read.tests')
-rw-r--r-- | tests/read.tests | 24 |
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 + |