| 1 | # Demo of redirecting from a here doc. |
| 2 | # |
| 3 | # All shells support this when passed a filename. But they all mess up |
| 4 | # when passed this code on stdin, because they simultaneously try to read from |
| 5 | # stdin! |
| 6 | |
| 7 | exec <<EOF |
| 8 | one |
| 9 | two |
| 10 | three |
| 11 | EOF |
| 12 | |
| 13 | read x |
| 14 | echo "x=$x" |
| 15 | read y |
| 16 | echo "y=$y" |
| 17 | #read z |
| 18 | #echo "z=$z" |
| 19 | echo DONE |