Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hazards of introducing commands not to follow #1372

Closed
karenword opened this issue Feb 23, 2023 · 3 comments
Closed

Hazards of introducing commands not to follow #1372

karenword opened this issue Feb 23, 2023 · 3 comments

Comments

@karenword
Copy link
Contributor

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.

@emcaulay
Copy link
Contributor

emcaulay commented Mar 6, 2023

This comment specifically relates to Episode 4, and the Tip Box labeled "Redirecting to the same file."

I think the feedback is valid, and I will write a new issue that may be easier to respond to.

@emcaulay
Copy link
Contributor

emcaulay commented Mar 7, 2023

To the maintainers, I recommend closing this issue and reviewing my revision #1375.

@bkmgit
Copy link
Contributor

bkmgit commented Mar 7, 2023

Thanks for your feedback.

@bkmgit bkmgit closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants