-
-
Notifications
You must be signed in to change notification settings - Fork 88
Glasgow | 26-SDC-Mar | Mohammed Abdoon | Sprint 2 | Shell Pipelines #411
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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { program } from "commander"; | ||
| import { promises as fs } from "node:fs"; | ||
|
|
||
| program.argument("<files...>").parse(); | ||
|
|
||
| for (const file of program.args) { | ||
| const stat = await fs.stat(file); | ||
|
|
||
| if (stat.isDirectory()) { | ||
| console.error(`cat: ${file}: Is a directory`); | ||
| continue; | ||
| } | ||
|
|
||
| const content = await fs.readFile(file, "utf-8"); | ||
| process.stdout.write(content); | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "dependencies": { | ||
| "commander": "^14.0.3" | ||
| }, | ||
| "type": "module" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ set -euo pipefail | |
|
|
||
| # TODO: Write a command to count the number of files in the sample-files directory whose name starts with an upper case letter and doesn't contain any other upper case letters. | ||
| # Your output should be the number 7. | ||
| ls sample-files | grep '^[A-Z][a-z]*$' | wc -l | ||
|
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. Does it pass something like File2.txt? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ set -euo pipefail | |
| # The input for this script is the events.txt file. | ||
| # TODO: Write a command to show how many times anyone has entered and exited. | ||
| # It should be clear from your script's output that there have been 5 Entry events and 4 Exit events. | ||
| sort events.txt | uniq -c | ||
|
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 groups by the full line (person + event type), producing 2 Entry German, 1 Entry Mariana, etc. - a reader has to sum the numbers to find the totals. The task requires the output to clearly show 5 Entry and 4 Exit. You need to count by event type only |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ set -euo pipefail | |
| # TODO: Write a command to show how many times anyone has entered and exited. | ||
| # It should be clear from your script's output that there have been 5 Entry events and 4 Exit events. | ||
| # The word "Event" should not appear in your script's output. | ||
| cut -d' ' -f2 events-with-timestamps.txt | sort | uniq -c | ||
|
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. events-with-timestamps.txt is tab-delimited, not space-delimited, thus it affects the work of this script |
||
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.
Does it pass something like File1.txt?