summaryrefslogtreecommitdiff
path: root/release/src/router/busybox/shell/ash_test/ash-read
diff options
context:
space:
mode:
Diffstat (limited to 'release/src/router/busybox/shell/ash_test/ash-read')
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-read/read_ifs.right7
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-read/read_ifs.tests7
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-read/read_n.right3
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-read/read_n.tests3
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-read/read_r.right2
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-read/read_r.tests2
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-read/read_t.right4
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-read/read_t.tests10
8 files changed, 38 insertions, 0 deletions
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_ifs.right b/release/src/router/busybox/shell/ash_test/ash-read/read_ifs.right
new file mode 100644
index 00000000..027ecd18
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_ifs.right
@@ -0,0 +1,7 @@
+.a. .b. .c.
+.a. .b. .c.
+.a. .. .b,c.
+.a. .. .b,c.
+.a. .. .c.
+.a. .. .c. .d.
+.a. .. .b,c,d , ,.
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_ifs.tests b/release/src/router/busybox/shell/ash_test/ash-read/read_ifs.tests
new file mode 100755
index 00000000..cf7cd934
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_ifs.tests
@@ -0,0 +1,7 @@
+printf 'a\t\tb\tc\n' | ( IFS=$(printf "\t") read a b c; echo ".$a. .$b. .$c." )
+printf 'a\t\tb\tc\n' | ( IFS=$(printf " \t") read a b c; echo ".$a. .$b. .$c." )
+printf 'a,,b,c\n' | ( IFS="," read a b c; echo ".$a. .$b. .$c." )
+printf 'a,,b,c\n' | ( IFS=" ," read a b c; echo ".$a. .$b. .$c." )
+printf 'a ,, c\n' | ( IFS=" ," read a b c; echo ".$a. .$b. .$c." )
+printf 'a ,, c d\n' | ( IFS=" ," read a b c d; echo ".$a. .$b. .$c. .$d." )
+printf ' a,,b,c,d , ,\n' | ( IFS=" ," read a b c; echo ".$a. .$b. .$c." )
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_n.right b/release/src/router/busybox/shell/ash_test/ash-read/read_n.right
new file mode 100644
index 00000000..1f81af0b
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_n.right
@@ -0,0 +1,3 @@
+test
+tes
+tes
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_n.tests b/release/src/router/busybox/shell/ash_test/ash-read/read_n.tests
new file mode 100755
index 00000000..12423ba6
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_n.tests
@@ -0,0 +1,3 @@
+echo 'test' | (read reply; echo "$reply")
+echo 'test' | (read -n 3 reply; echo "$reply")
+echo 'test' | (read -n3 reply; echo "$reply")
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_r.right b/release/src/router/busybox/shell/ash_test/ash-read/read_r.right
new file mode 100644
index 00000000..3536bf75
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_r.right
@@ -0,0 +1,2 @@
+testbest
+test\
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_r.tests b/release/src/router/busybox/shell/ash_test/ash-read/read_r.tests
new file mode 100755
index 00000000..2c4cc610
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_r.tests
@@ -0,0 +1,2 @@
+echo -e 'test\\\nbest' | (read reply; echo "$reply")
+echo -e 'test\\\nbest' | (read -r reply; echo "$reply")
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_t.right b/release/src/router/busybox/shell/ash_test/ash-read/read_t.right
new file mode 100644
index 00000000..04126cbe
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_t.right
@@ -0,0 +1,4 @@
+><
+><
+>test<
+>test<
diff --git a/release/src/router/busybox/shell/ash_test/ash-read/read_t.tests b/release/src/router/busybox/shell/ash_test/ash-read/read_t.tests
new file mode 100755
index 00000000..d65f1aea
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-read/read_t.tests
@@ -0,0 +1,10 @@
+# bash 3.2 outputs:
+
+# ><
+{ echo -n 'te'; sleep 2; echo 'st'; } | (read -t 1 reply; echo ">$reply<")
+# ><
+{ sleep 2; echo 'test'; } | (read -t 1 reply; echo ">$reply<")
+# >test<
+{ echo -n 'te'; sleep 1; echo 'st'; } | (read -t 2 reply; echo ">$reply<")
+# >test<
+{ sleep 1; echo 'test'; } | (read -t 2 reply; echo ">$reply<")