read_ifs2.tests 456 B

123456789
  1. echo "X:Y:Z:" | (IFS=": " read x y; echo "|$x|$y|")
  2. echo "X:Y:Z" | (IFS=": " read x y; echo "|$x|$y|")
  3. echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|")
  4. echo "X:Y" | (IFS=": " read x y; echo "|$x|$y|")
  5. echo "X:" | (IFS=": " read x y; echo "|$x|$y|")
  6. echo "X" | (IFS=": " read x y; echo "|$x|$y|")
  7. echo "" | (IFS=": " read x y; echo "|$x|$y|")
  8. echo Whitespace should be trimmed too:
  9. echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|")