-
-
Notifications
You must be signed in to change notification settings - Fork 27
Cape Town| 25-SDC-July | Faith Muzondo | Sprint 1 | Individual Shells tools #80
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ set -euo pipefail | |
|
||
# TODO: Write a command to output the contents of the helper-1.txt file inside the helper-files directory to the terminal. | ||
# The output of this command should be "Once upon a time...". | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sh file could work if it were run in the helper-files directory. However if I run it from here (the cat folder) it doesn't work. How would you make it work from here? |
||
cat helper-1.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ set -euo pipefail | |
# It looked delicious. | ||
# I was tempted to take a bite of it. | ||
# But this seemed like a bad idea... | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this would work if run from the right folder, but in general it's best to make sh files run from where they are in the checkout structure, or from a clearly defined location identified in a comment in the file (e.g. Module-Tools). |
||
cat individual-shell-tools/helper-files/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ set -euo pipefail | |
# 1 It looked delicious. | ||
# 2 I was tempted to take a bite of it. | ||
# 3 But this seemed like a bad idea... | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs the same relative path fix as the previous two comments, but otherwise looks good |
||
cat -n individual-shell-tools/helper-files/helper-3.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,7 @@ set -euo pipefail | |
|
||
# TODO: Write a command to output, for each `.txt` file in this directory, how many lines of dialogue the Doctor has. | ||
# The output should show that dialogue.txt contains 6 lines, dialogue-2.txt contains 2, and dialogue-3.txt contains 0. | ||
|
||
for FILE in *.txt; do | ||
grep -c "^Doctor" $FILE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a very subtle problem with this. Hints:
That's quite subtle! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is also a simpler way to do this without a for loop! |
||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ set -euo pipefail | |
# The output should contain 11 lines. | ||
# Line 3 should be "It contains many lines, and there are some things you may want to do with each of them.". | ||
# Line 11 should be "We also should remember, when we go shopping, to get 4 items: oranges, cheese, bread, olives.". | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well done, perfect score for sed |
||
sed -E 's/,([^ ])/, \1/g' input.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ set -euo pipefail | |
|
||
# TODO: Write a command to output the number of words in the file helper-files/helper-3.txt. | ||
# The output should include the number 19. The output should not include the number 92. | ||
wc -w < helper-files/helper-3.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has the same relative path problem we had in cat, but is otherwise correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost. Your code is giving each player's second score. However the question asks for the last score. Leila only has one score, so you need something slightly different.