Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- x=1
- echo fred>junk ; while read var ; do x=55 ; done <junk
- echo x=$x
- # x=55 .. I'd expect this result
- x=1
- cat junk | while read var ; do x=55 ; done
- echo x=$x
- # x=1 .. but why?
- x=1
- echo fred | while read var ; do x=55 ; done
- echo x=$x
- # x=1 .. but why?
- a=0; a=1 | a=2; echo $a
- cat junk | {
- while read var ; do x=55 ; done
- echo x=$x
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement