This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
unix_102 [2016/06/07 13:51] peek [Playing Around] |
unix_102 [2016/06/07 13:57] (current) peek |
||
|---|---|---|---|
| Line 359: | Line 359: | ||
| ^ Get a text file to play around with || | ^ Get a text file to play around with || | ||
| ^ Type: | < | ^ Type: | < | ||
| - | --2016-06-07 09: | + | --2016-06-07 09: |
| + | re.txt | ||
| Resolving ocw.mit.edu (ocw.mit.edu)... 23.15.135.8, | Resolving ocw.mit.edu (ocw.mit.edu)... 23.15.135.8, | ||
| Connecting to ocw.mit.edu (ocw.mit.edu)|23.15.135.8|: | Connecting to ocw.mit.edu (ocw.mit.edu)|23.15.135.8|: | ||
| Line 422: | Line 423: | ||
| 9081 you | 9081 you | ||
| </ | </ | ||
| + | ^ NOTE: How would you know to do that!? | ||
| ^ In the file '/ | ^ In the file '/ | ||
| ^ Type: | < | ^ Type: | < | ||
| Line 438: | Line 440: | ||
| 0 | 0 | ||
| </ | </ | ||
| - | ^ NOTE: That didn't work! Why? Because the while loop executes in a subshell, and while it is possible to pass values of exported values from parent shell to child subshell, the child gets a copy and not the original variable. | + | ^ | NOTE: That didn't work! Why? Because the while loop executes in a subshell, and while it is possible to pass values of exported values from parent shell to child subshell, the child gets a copy and not the original variable. |
| ^ So what's the correct way to do it? Here's one way that works: || | ^ So what's the correct way to do it? Here's one way that works: || | ||
| ^ Type: | < | ^ Type: | < | ||
| Line 447: | Line 449: | ||
| 68740 | 68740 | ||
| </ | </ | ||
| - | ^ NOTE: The for loop doesn' | + | ^ | NOTE: The for loop doesn' |