busybox/shell/hush_test/hush-read/read_ifs2.tests
Denys Vlasenko 44257ad5d0 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 <vda.linux@googlemail.com>
2018-04-11 17:18:34 +02:00

10 lines
456 B
Plaintext
Executable File

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|")