fork download
  1. #!/bin/bash
  2.  
  3. echo "Correct IFS:"
  4. while IFS=$'\t' read a b; do echo "<$b>"; done <<EOF
  5. some thing abc
  6. some thing def
  7. some thing 123
  8. EOF
  9. echo "Incorrect IFS:"
  10. while read a b; do echo "<$b>"; done <<EOF
  11. some thing abc
  12. some thing def
  13. some thing 123
  14. EOF
  15. echo "Incorrect IFS:"
  16. while IFS=\t read a b; do echo "<$b>"; done <<EOF
  17. some thing abc
  18. some thing def
  19. some thing 123
  20. EOF
  21.  
  22.  
Success #stdin #stdout 0s 4396KB
stdin
Standard input is empty
stdout
Correct IFS:
<abc>
<def>
<123>
Incorrect IFS:
<thing	abc>
<thing	def>
<thing	123>
Incorrect IFS:
<hing	abc>
<hing	def>
<hing	123>