From 44257ad5d0790a846423c9ef69a50049366b4578 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 11 Apr 2018 17:18:34 +0200 Subject: hush: fix IFS handling in read $ echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|") |X|Y| $ echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|") |X|Y| function old new delta shell_builtin_read 1320 1426 +106 Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-read/read_ifs2.tests | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 shell/hush_test/hush-read/read_ifs2.tests (limited to 'shell/hush_test/hush-read/read_ifs2.tests') diff --git a/shell/hush_test/hush-read/read_ifs2.tests b/shell/hush_test/hush-read/read_ifs2.tests new file mode 100755 index 0000000..f01a689 --- /dev/null +++ b/shell/hush_test/hush-read/read_ifs2.tests @@ -0,0 +1,9 @@ +echo "X:Y:Z:" | (IFS=": " read x y; echo "|$x|$y|") +echo "X:Y:Z" | (IFS=": " read x y; echo "|$x|$y|") +echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|") +echo "X:Y" | (IFS=": " read x y; echo "|$x|$y|") +echo "X:" | (IFS=": " read x y; echo "|$x|$y|") +echo "X" | (IFS=": " read x y; echo "|$x|$y|") +echo "" | (IFS=": " read x y; echo "|$x|$y|") +echo Whitespace should be trimmed too: +echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|") -- cgit v1.1