You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a member of The Carpentries Core Team and I'm submitting this issue on behalf of another member of the community. In most cases, I won't be able to follow up or provide more details other than what I'm providing below.
There is a general flow to the entire unix shell course of discussing commands and concepts and then giving the student examples to follow. It's very incongruous then that at the Redirecting To The Same File part, students are then given a concept and shown bash commands NOT to follow! Yes, the text does say this is a bad idea, but a student will not know why. As the rest of the course is showing you examples to follow so that you understand the concept, it is not unreasonable to assume that when the example of the sort command being used to redirect output to the same file as the input, one is supposed to do this so one can actually see the mistaken results.
Doing this ends up zeroing out the contents of lengths.txt, but we're not done with it yet! As we move on and need to use it later, we've shot ourselves in the foot by following the previous sort redirection example.
Suggestion to make this better - Amend the text as follows:
It's a very bad idea to try redirecting the output of a command that operates on a file to the same file. We will make a copy of lengths.txt to use as an example:
BASH
$ cp lengths.txt lencopy.txt
$ sort -n lencopy.txt > lencopy.txt
Doing something like this may give you incorrect results and/or delete the contents of the file. You'll find lencopy.txt is no longer a copy, and is likely blank now.
Now as we move on and need lengths.txt later, we still have the contents we want.
The text was updated successfully, but these errors were encountered:
I'm a member of The Carpentries Core Team and I'm submitting this issue on behalf of another member of the community. In most cases, I won't be able to follow up or provide more details other than what I'm providing below.
There is a general flow to the entire unix shell course of discussing commands and concepts and then giving the student examples to follow. It's very incongruous then that at the Redirecting To The Same File part, students are then given a concept and shown bash commands NOT to follow! Yes, the text does say this is a bad idea, but a student will not know why. As the rest of the course is showing you examples to follow so that you understand the concept, it is not unreasonable to assume that when the example of the sort command being used to redirect output to the same file as the input, one is supposed to do this so one can actually see the mistaken results.
Doing this ends up zeroing out the contents of lengths.txt, but we're not done with it yet! As we move on and need to use it later, we've shot ourselves in the foot by following the previous sort redirection example.
Suggestion to make this better - Amend the text as follows:
It's a very bad idea to try redirecting the output of a command that operates on a file to the same file. We will make a copy of lengths.txt to use as an example:
BASH
$ cp lengths.txt lencopy.txt
$ sort -n lencopy.txt > lencopy.txt
Doing something like this may give you incorrect results and/or delete the contents of the file. You'll find lencopy.txt is no longer a copy, and is likely blank now.
Now as we move on and need lengths.txt later, we still have the contents we want.
The text was updated successfully, but these errors were encountered: