From 39f14ef1dc102f632af0b33dfddf0afe32659286 Mon Sep 17 00:00:00 2001 From: JanefrancessC Date: Fri, 15 May 2026 13:59:48 +0100 Subject: [PATCH 1/2] chore: Remove wrong files from branch --- implement-shell-tools/cat/README.md | 10 +++++----- implement-shell-tools/ls/README.md | 6 +++--- implement-shell-tools/wc/README.md | 10 +++++----- individual-shell-tools/README.md | 1 + individual-shell-tools/sed/script-01.sh | 2 +- jq/person.json | 10 +++------- jq/scores.json | 9 ++++++++- jq/script-01.sh | 2 ++ jq/script-02.sh | 2 ++ jq/script-03.sh | 1 + jq/script-04.sh | 1 + jq/script-05.sh | 3 +++ jq/script-06.sh | 1 + jq/script-07.sh | 1 + jq/script-08.sh | 1 + jq/script-09.sh | 1 + jq/script-10.sh | 1 + jq/script-11.sh | 1 + 18 files changed, 41 insertions(+), 22 deletions(-) diff --git a/implement-shell-tools/cat/README.md b/implement-shell-tools/cat/README.md index 7284a5e6..71a08ca9 100644 --- a/implement-shell-tools/cat/README.md +++ b/implement-shell-tools/cat/README.md @@ -6,11 +6,11 @@ Your task is to implement your own version of `cat`. It must act the same as `cat` would, if run from the directory containing this README.md file, for the following command lines: -* `cat sample-files/1.txt` -* `cat -n sample-files/1.txt` -* `cat sample-files/*.txt` -* `cat -n sample-files/*.txt` -* `cat -b sample-files/3.txt` +- `cat sample-files/1.txt` +- `cat -n sample-files/1.txt` +- `cat sample-files/*.txt` +- `cat -n sample-files/*.txt` +- `cat -b sample-files/3.txt` Matching any additional behaviours or flags are optional stretch goals. diff --git a/implement-shell-tools/ls/README.md b/implement-shell-tools/ls/README.md index edbfb811..d6355d0e 100644 --- a/implement-shell-tools/ls/README.md +++ b/implement-shell-tools/ls/README.md @@ -6,9 +6,9 @@ Your task is to implement your own version of `ls`. It must act the same as `ls` would, if run from the directory containing this README.md file, for the following command lines: -* `ls -1` -* `ls -1 sample-files` -* `ls -1 -a sample-files` +- `ls -1` +- `ls -1 sample-files` +- `ls -1 -a sample-files` Matching any additional behaviours or flags are optional stretch goals. diff --git a/implement-shell-tools/wc/README.md b/implement-shell-tools/wc/README.md index bd76b655..c4b76b64 100644 --- a/implement-shell-tools/wc/README.md +++ b/implement-shell-tools/wc/README.md @@ -6,11 +6,11 @@ Your task is to implement your own version of `wc`. It must act the same as `wc` would, if run from the directory containing this README.md file, for the following command lines: -* `wc sample-files/*` -* `wc -l sample-files/3.txt` -* `wc -w sample-files/3.txt` -* `wc -c sample-files/3.txt` -* `wc -l sample-files/*` +- `wc sample-files/*` +- `wc -l sample-files/3.txt` +- `wc -w sample-files/3.txt` +- `wc -c sample-files/3.txt` +- `wc -l sample-files/*` Matching any additional behaviours or flags are optional stretch goals. diff --git a/individual-shell-tools/README.md b/individual-shell-tools/README.md index c5ace3a5..61920905 100644 --- a/individual-shell-tools/README.md +++ b/individual-shell-tools/README.md @@ -16,6 +16,7 @@ You should write all of your scripts assuming they're running inside the directo Some folders contain a README.md explaining more information, others do not. We recommend approaching the tools in this order: + 1. `ls` 2. `cat` 3. `wc` diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index d592970f..3eba6fa4 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -4,4 +4,4 @@ set -euo pipefail # TODO: Write a command to output input.txt with all occurrences of the letter `i` replaced with `I`. # The output should contain 11 lines. -# The first line of the output should be: "ThIs Is a sample fIle for experImentIng wIth sed.". +# The first line of the output should be: "ThIs Is a sample fIle for experImentIng with sed.". diff --git a/jq/person.json b/jq/person.json index 3d3bfb14..bdd6e9c0 100644 --- a/jq/person.json +++ b/jq/person.json @@ -1,9 +1,5 @@ { - "name": "Selma", - "profession": "Software Engineer", - "address": [ - "35 Fashion Street", - "London", - "E1 6PX" - ] + "name": "Selma", + "profession": "Software Engineer", + "address": ["35 Fashion Street", "London", "E1 6PX"] } diff --git a/jq/scores.json b/jq/scores.json index d5f62bf7..1daea214 100644 --- a/jq/scores.json +++ b/jq/scores.json @@ -1 +1,8 @@ -[{"name": "Ahmed", "city": "London", "scores": [1, 10, 4]}, {"name": "Basia", "city": "London", "scores": [22, 9, 6]}, {"name": "Mehmet", "city": "Birmingham", "scores": [3, 12, 17]}, {"name": "Leila", "city": "London", "scores": [1]}, {"name": "Piotr", "city": "Glasgow", "scores": [15, 2, 25, 11, 8]}, {"name": "Chandra", "city": "Birmingham", "scores": [12, 6]}] +[ + { "name": "Ahmed", "city": "London", "scores": [1, 10, 4] }, + { "name": "Basia", "city": "London", "scores": [22, 9, 6] }, + { "name": "Mehmet", "city": "Birmingham", "scores": [3, 12, 17] }, + { "name": "Leila", "city": "London", "scores": [1] }, + { "name": "Piotr", "city": "Glasgow", "scores": [15, 2, 25, 11, 8] }, + { "name": "Chandra", "city": "Birmingham", "scores": [12, 6] } +] diff --git a/jq/script-01.sh b/jq/script-01.sh index 95827f68..8199bde8 100755 --- a/jq/script-01.sh +++ b/jq/script-01.sh @@ -5,3 +5,5 @@ set -euo pipefail # The input for this script is the person.json file. # TODO: Write a command to output the name of the person. # Your output should be exactly the string "Selma", but should not contain any quote characters. +# jq -r '.name' < person.json //using redirection to the input +jq -r '.name' person.json \ No newline at end of file diff --git a/jq/script-02.sh b/jq/script-02.sh index 21544d67..2c91251d 100755 --- a/jq/script-02.sh +++ b/jq/script-02.sh @@ -5,3 +5,5 @@ set -euo pipefail # The input for this script is the person.json file. # TODO: Write a command to output the address of the person, all on one line, with a comma between each line. # Your output should be exactly the string "35 Fashion Street, London, E1 6PX", but should not contain any quote characters. +# jq -jr '.address | join(", "), "\n"' < ./person.json +jq -r '.address | join(", ")' person.json \ No newline at end of file diff --git a/jq/script-03.sh b/jq/script-03.sh index 3566f03b..c5b2d554 100755 --- a/jq/script-03.sh +++ b/jq/script-03.sh @@ -5,3 +5,4 @@ set -euo pipefail # The input for this script is the person.json file. # TODO: Write a command to output the name of the person, then a comma, then their profession. # Your output should be exactly the string "Selma, Software Engineer", but should not contain any quote characters. +jq -r '.name + ", " + .profession' person.json \ No newline at end of file diff --git a/jq/script-04.sh b/jq/script-04.sh index 015997e1..7fb3777d 100755 --- a/jq/script-04.sh +++ b/jq/script-04.sh @@ -6,3 +6,4 @@ set -euo pipefail # TODO: Write a command to output just the names of each player, one per line. # Your output should contain 6 lines, each with just one word on it. # Your output should not contain any quote characters. +jq -r '.[].name' scores.json \ No newline at end of file diff --git a/jq/script-05.sh b/jq/script-05.sh index 993fc9ee..bb0c7d79 100755 --- a/jq/script-05.sh +++ b/jq/script-05.sh @@ -5,3 +5,6 @@ set -euo pipefail # The input for this script is the scores.json file. # TODO: Write a command to output the names of each player, as well as their city. # Your output should contain 6 lines, each with two words on it. +# jq -jr '.[] | .name + (" ") + .city, "\n"' < ./scores.json +# jq -r '.[] | "\(.name) \(.city)"' < ./scores.json +jq -r '.[] | [.name, .city] | join(" ")' scores.json \ No newline at end of file diff --git a/jq/script-06.sh b/jq/script-06.sh index 8b6e74c5..4b895639 100755 --- a/jq/script-06.sh +++ b/jq/script-06.sh @@ -6,3 +6,4 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the score from their first attempt. # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 1" with no quotes. +jq -r '.[] | "\(.name) \(.scores[0])"' scores.json \ No newline at end of file diff --git a/jq/script-07.sh b/jq/script-07.sh index d43f93d1..46fb466c 100755 --- a/jq/script-07.sh +++ b/jq/script-07.sh @@ -6,3 +6,4 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the score from their last attempt. # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 4" with no quotes. +jq -r '.[] | "\(.name) \(.scores[-1])"' scores.json \ No newline at end of file diff --git a/jq/script-08.sh b/jq/script-08.sh index 6671fd1b..ecd84638 100755 --- a/jq/script-08.sh +++ b/jq/script-08.sh @@ -6,3 +6,4 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the number of times they've played the game. # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 3" with no quotes. +jq -r '.[] | "\(.name) \(.scores | length)"' scores.json \ No newline at end of file diff --git a/jq/script-09.sh b/jq/script-09.sh index c2536a53..169ea0d6 100755 --- a/jq/script-09.sh +++ b/jq/script-09.sh @@ -6,3 +6,4 @@ set -euo pipefail # TODO: Write a command to output just the names of each player along with the total scores from all of their games added together. # Your output should contain 6 lines, each with one word and one number on it. # The first line should be "Ahmed 15" with no quotes. +jq -r '.[] | "\(.name) \(.scores | add)"' scores.json \ No newline at end of file diff --git a/jq/script-10.sh b/jq/script-10.sh index 8e9d75f0..7bd0a41e 100755 --- a/jq/script-10.sh +++ b/jq/script-10.sh @@ -5,3 +5,4 @@ set -euo pipefail # The input for this script is the scores.json file. # TODO: Write a command to output the total of adding together all players' first scores. # Your output should be exactly the number 54. +jq '[.[] | .scores[0]] | add' scores.json \ No newline at end of file diff --git a/jq/script-11.sh b/jq/script-11.sh index d2337a6b..df747b4c 100755 --- a/jq/script-11.sh +++ b/jq/script-11.sh @@ -5,3 +5,4 @@ set -euo pipefail # The input for this script is the scores.json file. # TODO: Write a command to output the total of adding together all scores from all games from all players. # Your output should be exactly the number 164. +jq '[.[] | .scores[]] | add' scores.json From 23c44a214e6288199432e481b793f5c1fc544bdf Mon Sep 17 00:00:00 2001 From: JanefrancessC Date: Fri, 15 May 2026 14:32:12 +0100 Subject: [PATCH 2/2] chore: revert unintended prettier changes --- implement-shell-tools/cat/README.md | 10 +++++----- implement-shell-tools/ls/README.md | 6 +++--- implement-shell-tools/wc/README.md | 10 +++++----- individual-shell-tools/README.md | 1 - individual-shell-tools/sed/script-01.sh | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/implement-shell-tools/cat/README.md b/implement-shell-tools/cat/README.md index 71a08ca9..7284a5e6 100644 --- a/implement-shell-tools/cat/README.md +++ b/implement-shell-tools/cat/README.md @@ -6,11 +6,11 @@ Your task is to implement your own version of `cat`. It must act the same as `cat` would, if run from the directory containing this README.md file, for the following command lines: -- `cat sample-files/1.txt` -- `cat -n sample-files/1.txt` -- `cat sample-files/*.txt` -- `cat -n sample-files/*.txt` -- `cat -b sample-files/3.txt` +* `cat sample-files/1.txt` +* `cat -n sample-files/1.txt` +* `cat sample-files/*.txt` +* `cat -n sample-files/*.txt` +* `cat -b sample-files/3.txt` Matching any additional behaviours or flags are optional stretch goals. diff --git a/implement-shell-tools/ls/README.md b/implement-shell-tools/ls/README.md index d6355d0e..edbfb811 100644 --- a/implement-shell-tools/ls/README.md +++ b/implement-shell-tools/ls/README.md @@ -6,9 +6,9 @@ Your task is to implement your own version of `ls`. It must act the same as `ls` would, if run from the directory containing this README.md file, for the following command lines: -- `ls -1` -- `ls -1 sample-files` -- `ls -1 -a sample-files` +* `ls -1` +* `ls -1 sample-files` +* `ls -1 -a sample-files` Matching any additional behaviours or flags are optional stretch goals. diff --git a/implement-shell-tools/wc/README.md b/implement-shell-tools/wc/README.md index c4b76b64..bd76b655 100644 --- a/implement-shell-tools/wc/README.md +++ b/implement-shell-tools/wc/README.md @@ -6,11 +6,11 @@ Your task is to implement your own version of `wc`. It must act the same as `wc` would, if run from the directory containing this README.md file, for the following command lines: -- `wc sample-files/*` -- `wc -l sample-files/3.txt` -- `wc -w sample-files/3.txt` -- `wc -c sample-files/3.txt` -- `wc -l sample-files/*` +* `wc sample-files/*` +* `wc -l sample-files/3.txt` +* `wc -w sample-files/3.txt` +* `wc -c sample-files/3.txt` +* `wc -l sample-files/*` Matching any additional behaviours or flags are optional stretch goals. diff --git a/individual-shell-tools/README.md b/individual-shell-tools/README.md index 61920905..c5ace3a5 100644 --- a/individual-shell-tools/README.md +++ b/individual-shell-tools/README.md @@ -16,7 +16,6 @@ You should write all of your scripts assuming they're running inside the directo Some folders contain a README.md explaining more information, others do not. We recommend approaching the tools in this order: - 1. `ls` 2. `cat` 3. `wc` diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index 3eba6fa4..d592970f 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -4,4 +4,4 @@ set -euo pipefail # TODO: Write a command to output input.txt with all occurrences of the letter `i` replaced with `I`. # The output should contain 11 lines. -# The first line of the output should be: "ThIs Is a sample fIle for experImentIng with sed.". +# The first line of the output should be: "ThIs Is a sample fIle for experImentIng wIth sed.".