From 46aeab9a349d097307a87d7dfde3057f9e4e6722 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 31 Mar 2009 19:18:17 +0000 Subject: ash: fix $IFS handling in read. closes bug 235 --- shell/ash_test/ash-read/read_ifs.right | 7 +++++++ shell/ash_test/ash-read/read_ifs.tests | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 shell/ash_test/ash-read/read_ifs.right create mode 100755 shell/ash_test/ash-read/read_ifs.tests (limited to 'shell/ash_test') diff --git a/shell/ash_test/ash-read/read_ifs.right b/shell/ash_test/ash-read/read_ifs.right new file mode 100644 index 000000000..027ecd18f --- /dev/null +++ b/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/shell/ash_test/ash-read/read_ifs.tests b/shell/ash_test/ash-read/read_ifs.tests new file mode 100755 index 000000000..cf7cd934c --- /dev/null +++ b/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." ) -- cgit v1.2.3