Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions shell-pipelines/sort-uniq-head-tail/script-02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ set -euo pipefail
# The input for this script is the scores-table.txt file.
# TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending.
# The first line of your output should be "Basia London 22 9 6" (with no quotes).

sort -k3,3r scores-table.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new line you added here is code only, with no comment. Since this review is focused on comments that might not add much value, there’s nothing to improve on this particular change. When you do add comments in the future, it can be useful to ask yourself: “Would this still be helpful to someone who already understands basic shell tools like sort?” If the answer is no, the code might be clear enough on its own.

To "like" or "dislike" this comment, please follow this link

2 changes: 2 additions & 0 deletions shell-pipelines/sort-uniq-head-tail/script-04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ set -euo pipefail
# The input for this script is the scores-table.txt file.
# TODO: Write a command to output scores-table.txt, with shows the line for the player whose first score was the second highest.
# Your output should be: "Piotr Glasgow 15 2 25 11 8" (without quotes).

sort -k3,3nr scores-table.txt | head -n 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous file, this line is pure code with no extra comment. That’s usually a good sign that you’re letting the code speak for itself. As you keep practicing, you might reflect on whether commands like sort ... | head -n 2 are self-explanatory to your intended audience. If they are, adding a comment that just restates what the command does might not be necessary.

To "like" or "dislike" this comment, please follow this link

2 changes: 2 additions & 0 deletions shell-pipelines/sort-uniq-head-tail/script-05.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ set -euo pipefail
# TODO: Write a command to show a list of all events that have happened, without duplication.
# The order they're displayed doesn't matter, but we never want to see the same event listed twice.
# Your output should contain 6 lines.

uniq events.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well, there is no new comment, only the uniq command. In cases like this, the combination of the exercise description above and the shell command is usually enough for readers to understand the intent. If you ever feel tempted to add something like # remove duplicate events directly above uniq events.txt, you might ask yourself whether that comment would tell the reader anything they couldn’t already infer from the command name.

To "like" or "dislike" this comment, please follow this link

Loading