Advertisement
Guest User

How would you represent EOF in bash

a guest
Feb 26th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. read -d EOF stdin
  2.  
  3. for word in $stdin; do stuff; done
  4.  
  5. stdin=$(cat)
  6. for word in $stdin; do stuff; done
  7.  
  8. while read -r -a array; do
  9. for word in "${array[@]}"; do
  10. stuff;
  11. done
  12. done
  13.  
  14. if test "$char" = '^V'; then...
  15.  
  16. $ cat | od -b
  17. ^D
  18. 0000000 004 012
  19. 0000002
  20.  
  21. $ read -d "$(echo -e '04')" stdin
  22. foo
  23. bar quuz^Hx
  24. ^D
  25. $ echo "$stdin"
  26. foo
  27. bar quux
  28. $ for word in $stdin; do echo $word; done
  29. foo
  30. bar
  31. quux
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement