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>
This commit is contained in:
9
shell/hush_test/hush-read/read_ifs2.right
Normal file
9
shell/hush_test/hush-read/read_ifs2.right
Normal file
@@ -0,0 +1,9 @@
|
||||
|X|Y:Z:|
|
||||
|X|Y:Z|
|
||||
|X|Y|
|
||||
|X|Y|
|
||||
|X||
|
||||
|X||
|
||||
|||
|
||||
Whitespace should be trimmed too:
|
||||
|X|Y|
|
9
shell/hush_test/hush-read/read_ifs2.tests
Executable file
9
shell/hush_test/hush-read/read_ifs2.tests
Executable file
@@ -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|")
|
Reference in New Issue
Block a user