From dc8dfaf5f07a1177e6d08d5bc98240d678143d80 Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sat, 21 Mar 2026 22:34:12 +0000 Subject: [PATCH 1/9] ls-grep exerise --- shell-pipelines/ls-grep/script-01.sh | 1 + shell-pipelines/ls-grep/script-02.sh | 1 + shell-pipelines/ls-grep/script-03.sh | 1 + shell-pipelines/ls-grep/script-04.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/shell-pipelines/ls-grep/script-01.sh b/shell-pipelines/ls-grep/script-01.sh index 8c7d968a2..2530df5cf 100755 --- a/shell-pipelines/ls-grep/script-01.sh +++ b/shell-pipelines/ls-grep/script-01.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name contains at least one upper case letter. # Your output should contain 11 files. +ls sample-files | grep '[A-Z]' \ No newline at end of file diff --git a/shell-pipelines/ls-grep/script-02.sh b/shell-pipelines/ls-grep/script-02.sh index 16f5f71d9..90eb3f2bf 100755 --- a/shell-pipelines/ls-grep/script-02.sh +++ b/shell-pipelines/ls-grep/script-02.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter. # Your output should contain 10 files. +ls sample-files | grep '^[A-Z]' \ No newline at end of file diff --git a/shell-pipelines/ls-grep/script-03.sh b/shell-pipelines/ls-grep/script-03.sh index a302ab036..5c7a491be 100755 --- a/shell-pipelines/ls-grep/script-03.sh +++ b/shell-pipelines/ls-grep/script-03.sh @@ -4,3 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of the 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 contain 7 files. +ls sample-files | grep '^[A-Z][a-z]*$' diff --git a/shell-pipelines/ls-grep/script-04.sh b/shell-pipelines/ls-grep/script-04.sh index c000b7e3b..e165a5c5f 100755 --- a/shell-pipelines/ls-grep/script-04.sh +++ b/shell-pipelines/ls-grep/script-04.sh @@ -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 \ No newline at end of file From 6ea939b167d087e24d434477924fdce3f20cf73b Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sat, 21 Mar 2026 22:42:45 +0000 Subject: [PATCH 2/9] sort-uniq-head-tail exercises solved --- shell-pipelines/sort-uniq-head-tail/script-01.sh | 1 + shell-pipelines/sort-uniq-head-tail/script-02.sh | 1 + shell-pipelines/sort-uniq-head-tail/script-03.sh | 1 + shell-pipelines/sort-uniq-head-tail/script-04.sh | 1 + shell-pipelines/sort-uniq-head-tail/script-05.sh | 1 + shell-pipelines/sort-uniq-head-tail/script-06.sh | 1 + shell-pipelines/sort-uniq-head-tail/script-07.sh | 1 + 7 files changed, 7 insertions(+) diff --git a/shell-pipelines/sort-uniq-head-tail/script-01.sh b/shell-pipelines/sort-uniq-head-tail/script-01.sh index 171e1f989..1db218dbb 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-01.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-01.sh @@ -5,3 +5,4 @@ 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 name. # The first line of your output should be "Ahmed London 1 10 4" (with no quotes). And the third line should be "Chandra Birmingham 12 6". +sort scores-table.txt \ No newline at end of file diff --git a/shell-pipelines/sort-uniq-head-tail/script-02.sh b/shell-pipelines/sort-uniq-head-tail/script-02.sh index 29c3c2524..f32b03b63 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-02.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-02.sh @@ -5,3 +5,4 @@ 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,3nr scores-table.txt \ No newline at end of file diff --git a/shell-pipelines/sort-uniq-head-tail/script-03.sh b/shell-pipelines/sort-uniq-head-tail/script-03.sh index bcbaf3420..4b5cf8b99 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-03.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-03.sh @@ -8,3 +8,4 @@ set -euo pipefail # Basia London 22 9 6 # Piotr Glasgow 15 2 25 11 8 # Chandra Birmingham 12 6 +sort -k3,3nr scores-table.txt | head -n 3 \ No newline at end of file diff --git a/shell-pipelines/sort-uniq-head-tail/script-04.sh b/shell-pipelines/sort-uniq-head-tail/script-04.sh index 65a5cfba8..02b7b95fc 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-04.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-04.sh @@ -5,3 +5,4 @@ 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 | tail -n 1 \ No newline at end of file diff --git a/shell-pipelines/sort-uniq-head-tail/script-05.sh b/shell-pipelines/sort-uniq-head-tail/script-05.sh index a93cd9f9d..bdc16e1c8 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-05.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-05.sh @@ -6,3 +6,4 @@ 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. +sort events.txt | uniq \ No newline at end of file diff --git a/shell-pipelines/sort-uniq-head-tail/script-06.sh b/shell-pipelines/sort-uniq-head-tail/script-06.sh index 715c7ae5c..930f1d70c 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-06.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-06.sh @@ -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 \ No newline at end of file diff --git a/shell-pipelines/sort-uniq-head-tail/script-07.sh b/shell-pipelines/sort-uniq-head-tail/script-07.sh index 7fd07e1ff..0850c7743 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-07.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -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 \ No newline at end of file From d6556ad438ef3ea0bcab868562bb40c7d37aad5b Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sat, 21 Mar 2026 22:52:50 +0000 Subject: [PATCH 3/9] tr exercise --- shell-pipelines/tr/script-01.sh | 1 + shell-pipelines/tr/script-02.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/shell-pipelines/tr/script-01.sh b/shell-pipelines/tr/script-01.sh index 8bb0211e9..3553c5aa5 100755 --- a/shell-pipelines/tr/script-01.sh +++ b/shell-pipelines/tr/script-01.sh @@ -6,3 +6,4 @@ set -euo pipefail # The author got feedback that they're using too many exclamation marks (!). # # TODO: Write a command to output the contents of text.txt with every exclamation mark (!) replaced with a full-stop (.). +tr '!' '.' < text.txt \ No newline at end of file diff --git a/shell-pipelines/tr/script-02.sh b/shell-pipelines/tr/script-02.sh index cf3a503a2..a5250f788 100755 --- a/shell-pipelines/tr/script-02.sh +++ b/shell-pipelines/tr/script-02.sh @@ -7,3 +7,4 @@ set -euo pipefail # so every Y should be a Z, and every Z should be a Y! # # TODO: Write a command to output the contents of text.txt with every Y and Z swapped (both upper and lower case). +tr 'YyZz' 'ZzYy' < text.txt \ No newline at end of file From 852b400c2ec4fc93edcbae8a456477738b3aa79c Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Wed, 25 Mar 2026 20:58:12 +0000 Subject: [PATCH 4/9] works with regular inputs --- implement-shell-tools/cat/cat.js | 16 ++++++++++++++++ implement-shell-tools/cat/package-lock.json | 21 +++++++++++++++++++++ implement-shell-tools/cat/package.json | 6 ++++++ 3 files changed, 43 insertions(+) create mode 100644 implement-shell-tools/cat/cat.js create mode 100644 implement-shell-tools/cat/package-lock.json create mode 100644 implement-shell-tools/cat/package.json diff --git a/implement-shell-tools/cat/cat.js b/implement-shell-tools/cat/cat.js new file mode 100644 index 000000000..91b05a806 --- /dev/null +++ b/implement-shell-tools/cat/cat.js @@ -0,0 +1,16 @@ +import { program } from "commander"; +import { promises as fs } from "node:fs"; + +program.argument("").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); +} diff --git a/implement-shell-tools/cat/package-lock.json b/implement-shell-tools/cat/package-lock.json new file mode 100644 index 000000000..6179cab28 --- /dev/null +++ b/implement-shell-tools/cat/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "cat", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "commander": "^14.0.3" + } + }, + "node_modules/commander": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", + "license": "MIT", + "engines": { + "node": ">=20" + } + } + } +} diff --git a/implement-shell-tools/cat/package.json b/implement-shell-tools/cat/package.json new file mode 100644 index 000000000..402b2a4e9 --- /dev/null +++ b/implement-shell-tools/cat/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "commander": "^14.0.3" + }, + "type": "module" +} From 1742e2e9953030acc4bf43b81fcd83991b8a1543 Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sun, 10 May 2026 13:10:12 +0100 Subject: [PATCH 5/9] deleted unwanted files --- implement-shell-tools/cat/cat.js | 16 ---------------- implement-shell-tools/cat/package-lock.json | 21 --------------------- implement-shell-tools/cat/package.json | 6 ------ 3 files changed, 43 deletions(-) delete mode 100644 implement-shell-tools/cat/cat.js delete mode 100644 implement-shell-tools/cat/package-lock.json delete mode 100644 implement-shell-tools/cat/package.json diff --git a/implement-shell-tools/cat/cat.js b/implement-shell-tools/cat/cat.js deleted file mode 100644 index 91b05a806..000000000 --- a/implement-shell-tools/cat/cat.js +++ /dev/null @@ -1,16 +0,0 @@ -import { program } from "commander"; -import { promises as fs } from "node:fs"; - -program.argument("").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); -} diff --git a/implement-shell-tools/cat/package-lock.json b/implement-shell-tools/cat/package-lock.json deleted file mode 100644 index 6179cab28..000000000 --- a/implement-shell-tools/cat/package-lock.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "cat", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "dependencies": { - "commander": "^14.0.3" - } - }, - "node_modules/commander": { - "version": "14.0.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", - "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", - "license": "MIT", - "engines": { - "node": ">=20" - } - } - } -} diff --git a/implement-shell-tools/cat/package.json b/implement-shell-tools/cat/package.json deleted file mode 100644 index 402b2a4e9..000000000 --- a/implement-shell-tools/cat/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "commander": "^14.0.3" - }, - "type": "module" -} From d3381b8b7059faf3e625fed72799a173b9776448 Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sun, 10 May 2026 13:32:21 +0100 Subject: [PATCH 6/9] fixed script 6 --- shell-pipelines/sort-uniq-head-tail/script-01.sh | 2 +- shell-pipelines/sort-uniq-head-tail/script-02.sh | 2 +- shell-pipelines/sort-uniq-head-tail/script-03.sh | 2 +- shell-pipelines/sort-uniq-head-tail/script-04.sh | 2 +- shell-pipelines/sort-uniq-head-tail/script-05.sh | 2 +- shell-pipelines/sort-uniq-head-tail/script-06.sh | 4 +++- shell-pipelines/sort-uniq-head-tail/script-07.sh | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/shell-pipelines/sort-uniq-head-tail/script-01.sh b/shell-pipelines/sort-uniq-head-tail/script-01.sh index 1db218dbb..845ad89da 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-01.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-01.sh @@ -5,4 +5,4 @@ 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 name. # The first line of your output should be "Ahmed London 1 10 4" (with no quotes). And the third line should be "Chandra Birmingham 12 6". -sort scores-table.txt \ No newline at end of file +sort scores-table.txt diff --git a/shell-pipelines/sort-uniq-head-tail/script-02.sh b/shell-pipelines/sort-uniq-head-tail/script-02.sh index f32b03b63..e0281500d 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-02.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-02.sh @@ -5,4 +5,4 @@ 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,3nr scores-table.txt \ No newline at end of file +sort -k3,3nr scores-table.txt diff --git a/shell-pipelines/sort-uniq-head-tail/script-03.sh b/shell-pipelines/sort-uniq-head-tail/script-03.sh index 4b5cf8b99..01e6b4d0d 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-03.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-03.sh @@ -8,4 +8,4 @@ set -euo pipefail # Basia London 22 9 6 # Piotr Glasgow 15 2 25 11 8 # Chandra Birmingham 12 6 -sort -k3,3nr scores-table.txt | head -n 3 \ No newline at end of file +sort -k3,3nr scores-table.txt | head -n 3 diff --git a/shell-pipelines/sort-uniq-head-tail/script-04.sh b/shell-pipelines/sort-uniq-head-tail/script-04.sh index 02b7b95fc..5603cc47d 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-04.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-04.sh @@ -5,4 +5,4 @@ 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 | tail -n 1 \ No newline at end of file +sort -k3,3nr scores-table.txt | head -n 2 | tail -n 1 diff --git a/shell-pipelines/sort-uniq-head-tail/script-05.sh b/shell-pipelines/sort-uniq-head-tail/script-05.sh index bdc16e1c8..8eba57e36 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-05.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-05.sh @@ -6,4 +6,4 @@ 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. -sort events.txt | uniq \ No newline at end of file +sort events.txt | uniq diff --git a/shell-pipelines/sort-uniq-head-tail/script-06.sh b/shell-pipelines/sort-uniq-head-tail/script-06.sh index 930f1d70c..8737dc237 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-06.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-06.sh @@ -5,4 +5,6 @@ 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 \ No newline at end of file + +echo "Entry: $(grep -c 'Entry' events.txt)" +echo "Exit: $(grep -c 'Exit' events.txt)" diff --git a/shell-pipelines/sort-uniq-head-tail/script-07.sh b/shell-pipelines/sort-uniq-head-tail/script-07.sh index 0850c7743..0309b6c86 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-07.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -6,4 +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 \ No newline at end of file +cut -d' ' -f2 events-with-timestamps.txt | sort | uniq -c From 1cb2c0d6bf7f3c6885058ad6ea26ba9f81b5144f Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sun, 10 May 2026 13:33:09 +0100 Subject: [PATCH 7/9] fixed script 7 --- shell-pipelines/sort-uniq-head-tail/script-07.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell-pipelines/sort-uniq-head-tail/script-07.sh b/shell-pipelines/sort-uniq-head-tail/script-07.sh index 0309b6c86..b97c1c052 100755 --- a/shell-pipelines/sort-uniq-head-tail/script-07.sh +++ b/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -6,4 +6,5 @@ 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 +echo "Entry: $(grep -c 'Entry' events-with-timestamps.txt)" +echo "Exit: $(grep -c 'Exit' events-with-timestamps.txt)" From f9d2cd5b14a2a75e227b0beac4662816567408be Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sun, 10 May 2026 13:39:02 +0100 Subject: [PATCH 8/9] fixed script 3 --- shell-pipelines/ls-grep/script-03.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell-pipelines/ls-grep/script-03.sh b/shell-pipelines/ls-grep/script-03.sh index 5c7a491be..9b79f1c8c 100755 --- a/shell-pipelines/ls-grep/script-03.sh +++ b/shell-pipelines/ls-grep/script-03.sh @@ -4,4 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of the 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 contain 7 files. -ls sample-files | grep '^[A-Z][a-z]*$' +ls sample-files | grep '^[A-Z][^A-Z]*$' From 0f2481737e9dabd6b8da25d4c3591dd0f4eebd5e Mon Sep 17 00:00:00 2001 From: Mohammed Abdoon Date: Sun, 10 May 2026 13:41:53 +0100 Subject: [PATCH 9/9] added trailing lines + fixed script 4 --- shell-pipelines/ls-grep/script-01.sh | 2 +- shell-pipelines/ls-grep/script-02.sh | 2 +- shell-pipelines/ls-grep/script-04.sh | 2 +- shell-pipelines/tr/script-01.sh | 2 +- shell-pipelines/tr/script-02.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shell-pipelines/ls-grep/script-01.sh b/shell-pipelines/ls-grep/script-01.sh index 2530df5cf..b77993b26 100755 --- a/shell-pipelines/ls-grep/script-01.sh +++ b/shell-pipelines/ls-grep/script-01.sh @@ -4,4 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name contains at least one upper case letter. # Your output should contain 11 files. -ls sample-files | grep '[A-Z]' \ No newline at end of file +ls sample-files | grep '[A-Z]' diff --git a/shell-pipelines/ls-grep/script-02.sh b/shell-pipelines/ls-grep/script-02.sh index 90eb3f2bf..4fa4206cd 100755 --- a/shell-pipelines/ls-grep/script-02.sh +++ b/shell-pipelines/ls-grep/script-02.sh @@ -4,4 +4,4 @@ set -euo pipefail # TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter. # Your output should contain 10 files. -ls sample-files | grep '^[A-Z]' \ No newline at end of file +ls sample-files | grep '^[A-Z]' diff --git a/shell-pipelines/ls-grep/script-04.sh b/shell-pipelines/ls-grep/script-04.sh index e165a5c5f..b9b1fef9e 100755 --- a/shell-pipelines/ls-grep/script-04.sh +++ b/shell-pipelines/ls-grep/script-04.sh @@ -4,4 +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 \ No newline at end of file +ls sample-files | grep '^[A-Z][^A-Z]*$' | wc -l diff --git a/shell-pipelines/tr/script-01.sh b/shell-pipelines/tr/script-01.sh index 3553c5aa5..f91ef30d3 100755 --- a/shell-pipelines/tr/script-01.sh +++ b/shell-pipelines/tr/script-01.sh @@ -6,4 +6,4 @@ set -euo pipefail # The author got feedback that they're using too many exclamation marks (!). # # TODO: Write a command to output the contents of text.txt with every exclamation mark (!) replaced with a full-stop (.). -tr '!' '.' < text.txt \ No newline at end of file +tr '!' '.' < text.txt diff --git a/shell-pipelines/tr/script-02.sh b/shell-pipelines/tr/script-02.sh index a5250f788..96a208b9a 100755 --- a/shell-pipelines/tr/script-02.sh +++ b/shell-pipelines/tr/script-02.sh @@ -7,4 +7,4 @@ set -euo pipefail # so every Y should be a Z, and every Z should be a Y! # # TODO: Write a command to output the contents of text.txt with every Y and Z swapped (both upper and lower case). -tr 'YyZz' 'ZzYy' < text.txt \ No newline at end of file +tr 'YyZz' 'ZzYy' < text.txt