From db7b0f0024f1031c26c25d3d1d266832ae640e42 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 02:16:00 +0100 Subject: [PATCH 01/16] ls exercises --- individual-shell-tools/ls/script-01.sh | 2 ++ individual-shell-tools/ls/script-02.sh | 2 ++ individual-shell-tools/ls/script-03.sh | 2 ++ individual-shell-tools/ls/script-04.sh | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/individual-shell-tools/ls/script-01.sh b/individual-shell-tools/ls/script-01.sh index 241b62f5e..8f93bb79e 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -13,3 +13,5 @@ fi # TODO: Write a command to list the files and folders in this directory. # The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. + +ls \ No newline at end of file diff --git a/individual-shell-tools/ls/script-02.sh b/individual-shell-tools/ls/script-02.sh index d0a5a10f4..b026cfd6c 100755 --- a/individual-shell-tools/ls/script-02.sh +++ b/individual-shell-tools/ls/script-02.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command which lists all of the files in the directory named child-directory. # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. + +ls child-directory diff --git a/individual-shell-tools/ls/script-03.sh b/individual-shell-tools/ls/script-03.sh index 781216d21..b259fcb1d 100755 --- a/individual-shell-tools/ls/script-03.sh +++ b/individual-shell-tools/ls/script-03.sh @@ -5,3 +5,5 @@ set -euo pipefail # TODO: Write a command which _recursively_ lists all of the files and folders in this directory _and_ all of the files inside those folders. # The output should be a list of names including: child-directory, script-01.sh, helper-1.txt (and more). # The formatting of the output doesn't matter. + +ls -R \ No newline at end of file diff --git a/individual-shell-tools/ls/script-04.sh b/individual-shell-tools/ls/script-04.sh index 72f3817b3..061b4f3d0 100755 --- a/individual-shell-tools/ls/script-04.sh +++ b/individual-shell-tools/ls/script-04.sh @@ -16,8 +16,12 @@ echo "First exercise (sorted newest to oldest):" # TODO: Write a command which lists the files in the child-directory directory, one per line, sorted so that the most recently modified file is first. # The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt. +ls -1t child-directory + echo "Second exercise (sorted oldest to newest):" # TODO: Write a command which does the same as above, but sorted in the opposite order (oldest first). # The output should be a list of names in this order, one per line: helper-2.txt, helper-1.txt, helper-3.txt. + +ls -1tr child-directory \ No newline at end of file From 721d271cef0dcb94eeb52a5cf23605e3c2eea8b8 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 02:29:00 +0100 Subject: [PATCH 02/16] cat exercise --- individual-shell-tools/cat/script-01.sh | 2 ++ individual-shell-tools/cat/script-02.sh | 2 ++ individual-shell-tools/cat/script-03.sh | 2 ++ individual-shell-tools/cat/script-04-stretch.sh | 2 ++ 4 files changed, 8 insertions(+) diff --git a/individual-shell-tools/cat/script-01.sh b/individual-shell-tools/cat/script-01.sh index c85053e0f..da5ec5029 100755 --- a/individual-shell-tools/cat/script-01.sh +++ b/individual-shell-tools/cat/script-01.sh @@ -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...". + +cat ../helper-files/helper-1.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-02.sh b/individual-shell-tools/cat/script-02.sh index 01bbd5eab..f645a1aff 100755 --- a/individual-shell-tools/cat/script-02.sh +++ b/individual-shell-tools/cat/script-02.sh @@ -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... + +cat ../helper-files/*.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-03.sh b/individual-shell-tools/cat/script-03.sh index 37573b0c1..e4e7c7fe3 100755 --- a/individual-shell-tools/cat/script-03.sh +++ b/individual-shell-tools/cat/script-03.sh @@ -9,3 +9,5 @@ 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... + +cat -n ../helper-files/helper-3.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-04-stretch.sh b/individual-shell-tools/cat/script-04-stretch.sh index 00fe3c48b..9ba3dfeb2 100755 --- a/individual-shell-tools/cat/script-04-stretch.sh +++ b/individual-shell-tools/cat/script-04-stretch.sh @@ -13,3 +13,5 @@ set -euo pipefail # 3 It looked delicious. # 4 I was tempted to take a bite of it. # 5 But this seemed like a bad idea... + +cat ../helper-files/*.txt | cat -n \ No newline at end of file From e4bcf76693cee50d9858a66cf210e5830dcee92a Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 02:32:49 +0100 Subject: [PATCH 03/16] wc exercise --- individual-shell-tools/wc/script-01.sh | 2 ++ individual-shell-tools/wc/script-02.sh | 2 ++ individual-shell-tools/wc/script-03.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/individual-shell-tools/wc/script-01.sh b/individual-shell-tools/wc/script-01.sh index c9dd6e5df..554bc7208 100755 --- a/individual-shell-tools/wc/script-01.sh +++ b/individual-shell-tools/wc/script-01.sh @@ -4,3 +4,5 @@ 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 % wc -w ../helper-files/helper-3.txt \ No newline at end of file diff --git a/individual-shell-tools/wc/script-02.sh b/individual-shell-tools/wc/script-02.sh index 8feeb1a62..ae2ae870b 100755 --- a/individual-shell-tools/wc/script-02.sh +++ b/individual-shell-tools/wc/script-02.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output the number of lines in the file helper-files/helper-3.txt. # The output should include the number 3. The output should not include the number 19. + +wc -l ../helper-files/helper-3.txt diff --git a/individual-shell-tools/wc/script-03.sh b/individual-shell-tools/wc/script-03.sh index 6b2e9d3d1..3bc287a1a 100755 --- a/individual-shell-tools/wc/script-03.sh +++ b/individual-shell-tools/wc/script-03.sh @@ -8,3 +8,5 @@ set -euo pipefail # 1 7 39 ../helper-files/helper-2.txt # 3 19 92 ../helper-files/helper-3.txt # 5 30 151 total + +wc ../helper-files/*.txt \ No newline at end of file From c48dcce2b8f101b64f94f767111e84b4744c5cec Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 02:47:11 +0100 Subject: [PATCH 04/16] grep exercise --- individual-shell-tools/grep/script-01.sh | 2 ++ individual-shell-tools/grep/script-02.sh | 2 ++ individual-shell-tools/grep/script-03.sh | 2 ++ individual-shell-tools/grep/script-04.sh | 2 ++ individual-shell-tools/grep/script-05.sh | 2 ++ individual-shell-tools/grep/script-06.sh | 2 ++ individual-shell-tools/grep/script-07.sh | 2 ++ 7 files changed, 14 insertions(+) diff --git a/individual-shell-tools/grep/script-01.sh b/individual-shell-tools/grep/script-01.sh index fb05f42f2..acf8b4a96 100755 --- a/individual-shell-tools/grep/script-01.sh +++ b/individual-shell-tools/grep/script-01.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt said by the Doctor. # The output should contain 6 lines. + +grep ^Doctor: dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-02.sh b/individual-shell-tools/grep/script-02.sh index df6f85640..e05ea7ca6 100755 --- a/individual-shell-tools/grep/script-02.sh +++ b/individual-shell-tools/grep/script-02.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the word Doctor (regardless of case). # The output should contain 9 lines. + +grep -i Doctor dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-03.sh b/individual-shell-tools/grep/script-03.sh index 5383fe578..a6fef46f2 100755 --- a/individual-shell-tools/grep/script-03.sh +++ b/individual-shell-tools/grep/script-03.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output the number of lines in dialogue.txt that contain the word Doctor (regardless of case). # The output should be exactly the number 9. + +grep -ic Doctor dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-04.sh b/individual-shell-tools/grep/script-04.sh index 80ee04776..24bb2dfd7 100755 --- a/individual-shell-tools/grep/script-04.sh +++ b/individual-shell-tools/grep/script-04.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that does not contain the word "Hello" (regardless of case). # The output should contain 10 lines. + +grep -iv Hello dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-05.sh b/individual-shell-tools/grep/script-05.sh index 1eb538185..2391a370e 100755 --- a/individual-shell-tools/grep/script-05.sh +++ b/individual-shell-tools/grep/script-05.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the string "cure", as well as the line before that line. # The output should contain two pairs of two lines of text (with a separator between them). + +grep % grep -B 1 "cure" dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-06.sh b/individual-shell-tools/grep/script-06.sh index 5670e3b6c..c5b842195 100755 --- a/individual-shell-tools/grep/script-06.sh +++ b/individual-shell-tools/grep/script-06.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output the name of every `.txt` file in this directory which contains a line of dialogue said by the Doctor. # The output should contain two filenames. + +grep -l ^Doctor: *.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-07.sh b/individual-shell-tools/grep/script-07.sh index 9670ebad9..2ebba084b 100755 --- a/individual-shell-tools/grep/script-07.sh +++ b/individual-shell-tools/grep/script-07.sh @@ -4,3 +4,5 @@ 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. + +grep -c ^Doctor: *.txt From 8157633bd0a997a9cf5856403a744176879c926f Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 03:00:30 +0100 Subject: [PATCH 05/16] sed exercise --- individual-shell-tools/sed/script-01.sh | 2 ++ individual-shell-tools/sed/script-02.sh | 2 ++ individual-shell-tools/sed/script-03.sh | 2 ++ individual-shell-tools/sed/script-04.sh | 2 ++ individual-shell-tools/sed/script-05.sh | 2 ++ individual-shell-tools/sed/script-06.sh | 2 ++ 6 files changed, 12 insertions(+) diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index d592970fc..5d35f024c 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -5,3 +5,5 @@ 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.". + +sed % sed 's/i/I/' input.txt \ No newline at end of file diff --git a/individual-shell-tools/sed/script-02.sh b/individual-shell-tools/sed/script-02.sh index abdd64d06..0f32ffd6b 100755 --- a/individual-shell-tools/sed/script-02.sh +++ b/individual-shell-tools/sed/script-02.sh @@ -5,3 +5,5 @@ set -euo pipefail # TODO: Write a command to output input.txt with numbers removed. # The output should contain 11 lines. # Line 6 of the output should be " Alisha". + +sed 's/[0-9]*//g' input.txt \ No newline at end of file diff --git a/individual-shell-tools/sed/script-03.sh b/individual-shell-tools/sed/script-03.sh index dd284a296..e70f4a600 100755 --- a/individual-shell-tools/sed/script-03.sh +++ b/individual-shell-tools/sed/script-03.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output input.txt removing any line which contains a number. # The output should contain 6 lines. + +sed '/[0-9]/d' input.txt diff --git a/individual-shell-tools/sed/script-04.sh b/individual-shell-tools/sed/script-04.sh index 0052ac6c4..8ac6e7c5d 100755 --- a/individual-shell-tools/sed/script-04.sh +++ b/individual-shell-tools/sed/script-04.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output input.txt replacing every occurrence of the string "We'll" with "We will". # The output should contain 11 lines. + +sed "s/We'll/We will/g" input.txt diff --git a/individual-shell-tools/sed/script-05.sh b/individual-shell-tools/sed/script-05.sh index 2dcc91a0c..990ac2f2c 100755 --- a/individual-shell-tools/sed/script-05.sh +++ b/individual-shell-tools/sed/script-05.sh @@ -6,3 +6,5 @@ set -euo pipefail # If a line starts with a number and a space, make the line instead end with a space and the number. # So line 6 which currently reads "37 Alisha" should instead read "Alisha 37". # The output should contain 11 lines. + +sed -E 's/^([0-9]+) (.*)$/\2 \1/' input.txt diff --git a/individual-shell-tools/sed/script-06.sh b/individual-shell-tools/sed/script-06.sh index 0b9390170..6dad6a948 100755 --- a/individual-shell-tools/sed/script-06.sh +++ b/individual-shell-tools/sed/script-06.sh @@ -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.". + +sed 's/^\([0-9][0-9]*\) \(.*\)$/\2 \1/' input.txt \ No newline at end of file From 0d520d4953b13d2b271a1ae02ed1a4d580d57021 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 03:14:09 +0100 Subject: [PATCH 06/16] awk exercise --- individual-shell-tools/awk/script-01.sh | 2 ++ individual-shell-tools/awk/script-02.sh | 2 ++ individual-shell-tools/awk/script-03.sh | 2 ++ individual-shell-tools/awk/script-04.sh | 2 ++ individual-shell-tools/awk/script-05.sh | 2 ++ 5 files changed, 10 insertions(+) diff --git a/individual-shell-tools/awk/script-01.sh b/individual-shell-tools/awk/script-01.sh index 8db4390af..587ed2acb 100755 --- a/individual-shell-tools/awk/script-01.sh +++ b/individual-shell-tools/awk/script-01.sh @@ -4,3 +4,5 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in `scores-table.txt`. # Your output should contain 6 lines, each with just one word on it. + +awk '{print $1}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/awk/script-02.sh b/individual-shell-tools/awk/script-02.sh index 5956be9bd..a29bbbf1f 100755 --- a/individual-shell-tools/awk/script-02.sh +++ b/individual-shell-tools/awk/script-02.sh @@ -4,3 +4,5 @@ set -euo pipefail # 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, separated by a space. + +awk '{print $1, $2}' scores-table.txt diff --git a/individual-shell-tools/awk/script-03.sh b/individual-shell-tools/awk/script-03.sh index af7c6e8b9..67365bfa4 100755 --- a/individual-shell-tools/awk/script-03.sh +++ b/individual-shell-tools/awk/script-03.sh @@ -5,3 +5,5 @@ 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". + +awk '{print $1, $3}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/awk/script-04.sh b/individual-shell-tools/awk/script-04.sh index bf15703c7..6430de6dc 100755 --- a/individual-shell-tools/awk/script-04.sh +++ b/individual-shell-tools/awk/script-04.sh @@ -5,3 +5,5 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in London along with the score from their last attempt. # Your output should contain 3 lines, each with one word and one number on it. # The first line should be "Ahmed 4". + +awk '$2 == "London" {print $1, $5}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/awk/script-05.sh b/individual-shell-tools/awk/script-05.sh index d1680cb02..0df43b872 100755 --- a/individual-shell-tools/awk/script-05.sh +++ b/individual-shell-tools/awk/script-05.sh @@ -5,3 +5,5 @@ 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". + +awk '{print $1, NF-2}' scores-table.txt \ No newline at end of file From 98447832a531c63f945217869fed99915a532b9a Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 03:43:25 +0100 Subject: [PATCH 07/16] fix the errors --- individual-shell-tools/awk/script-04.sh | 2 +- individual-shell-tools/grep/script-05.sh | 2 +- individual-shell-tools/sed/script-01.sh | 2 +- individual-shell-tools/sed/script-06.sh | 2 +- individual-shell-tools/wc/script-01.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/individual-shell-tools/awk/script-04.sh b/individual-shell-tools/awk/script-04.sh index 6430de6dc..79da3d066 100755 --- a/individual-shell-tools/awk/script-04.sh +++ b/individual-shell-tools/awk/script-04.sh @@ -6,4 +6,4 @@ set -euo pipefail # Your output should contain 3 lines, each with one word and one number on it. # The first line should be "Ahmed 4". -awk '$2 == "London" {print $1, $5}' scores-table.txt \ No newline at end of file +awk '$2 == "London" {print $1, $NF}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-05.sh b/individual-shell-tools/grep/script-05.sh index 2391a370e..497a6e7f0 100755 --- a/individual-shell-tools/grep/script-05.sh +++ b/individual-shell-tools/grep/script-05.sh @@ -5,4 +5,4 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the string "cure", as well as the line before that line. # The output should contain two pairs of two lines of text (with a separator between them). -grep % grep -B 1 "cure" dialogue.txt \ No newline at end of file +grep -B 1 "cure" dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index 5d35f024c..a0b748a63 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -6,4 +6,4 @@ set -euo pipefail # The output should contain 11 lines. # The first line of the output should be: "ThIs Is a sample fIle for experImentIng wIth sed.". -sed % sed 's/i/I/' input.txt \ No newline at end of file +sed 's/i/I/' input.txt \ No newline at end of file diff --git a/individual-shell-tools/sed/script-06.sh b/individual-shell-tools/sed/script-06.sh index 6dad6a948..ab15800eb 100755 --- a/individual-shell-tools/sed/script-06.sh +++ b/individual-shell-tools/sed/script-06.sh @@ -9,4 +9,4 @@ set -euo pipefail # 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.". -sed 's/^\([0-9][0-9]*\) \(.*\)$/\2 \1/' input.txt \ No newline at end of file +sed 's/, */, /g' input.txt \ No newline at end of file diff --git a/individual-shell-tools/wc/script-01.sh b/individual-shell-tools/wc/script-01.sh index 554bc7208..22b7b8d9e 100755 --- a/individual-shell-tools/wc/script-01.sh +++ b/individual-shell-tools/wc/script-01.sh @@ -5,4 +5,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 % wc -w ../helper-files/helper-3.txt \ No newline at end of file +wc -w ../helper-files/helper-3.txt \ No newline at end of file From f8a25cc75d40159333beae39705590984f6d0284 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 10:42:06 +0100 Subject: [PATCH 08/16] fix: correct sed script-01 solution --- individual-shell-tools/sed/script-01.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index a0b748a63..0bd78a317 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -6,4 +6,4 @@ set -euo pipefail # The output should contain 11 lines. # The first line of the output should be: "ThIs Is a sample fIle for experImentIng wIth sed.". -sed 's/i/I/' input.txt \ No newline at end of file +sed 's/i/I/g' input.txt \ No newline at end of file From 19015e584cb2da2107dec365e50583cf750cf274 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 11:41:27 +0100 Subject: [PATCH 09/16] part1 number systems --- number-systems/Part-1.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/number-systems/Part-1.md b/number-systems/Part-1.md index d8f9c290e..68b77ea0b 100644 --- a/number-systems/Part-1.md +++ b/number-systems/Part-1.md @@ -6,49 +6,49 @@ The goal of these exercises is for you to gain an intuition for binary numbers. The answers to these questions should be a number, either in binary, hex, or decimal. -Q1: Convert the decimal number 14 to binary. -Answer: +Q1: Convert the decimal number 14 to binary. 0,2,4,8,16,32,64,128,256 +Answer: 1110 Q2: Convert the binary number 101101 to decimal: -Answer: +Answer: 45 Q3: Which is larger: 1000 or 0111? -Answer: +Answer: 1000 Q4: Which is larger: 00100 or 01011? -Answer: +Answer: 01011 Q5: What is 10101 + 01010? -Answer: +Answer: 11111 Q6: What is 10001 + 10001? -Answer: +Answer: 100010 Q7: What's the largest number you can store with 4 bits, if you want to be able to represent the number 0? -Answer: +Answer: 15 Q8: How many bits would you need in order to store the numbers between 0 and 255 inclusive? -Answer: +Answer: 9 Q9: How many bits would you need in order to store the numbers between 0 and 3 inclusive? -Answer: +Answer: 2 Q10: How many bits would you need in order to store the numbers between 0 and 1000 inclusive? -Answer: +Answer: 10 Q11: Convert the decimal number 14 to hex. -Answer: +Answer: E Q12: Convert the decimal number 386 to hex. -Answer: +Answer: 182 Q13: Convert the hex number 386 to decimal. -Answer: +Answer: 902 Q14: Convert the hex number B to decimal. -Answer: +Answer: 11 Q15: If reading the byte 0x21 as a number, what decimal number would it mean? -Answer: +Answer: 33 Q16: Continues in Part-2 From 3e44d1cb6d008aa8376492a43e019440110283c5 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 12:27:55 +0100 Subject: [PATCH 10/16] part 2 number system --- number-systems/Part-2.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/number-systems/Part-2.md b/number-systems/Part-2.md index 68b0933d9..1fce42ee7 100644 --- a/number-systems/Part-2.md +++ b/number-systems/Part-2.md @@ -7,16 +7,18 @@ The goal of these exercises is for you to gain an intuition for binary numbers. The answers to these questions will require a bit of explanation, not just a simple answer. Q16: How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)? -Answer: +Answer: If there is just one 1 in a binary number, then it is a power of 2. This is because each bit represents a power of 2, so if there is just one 1 bit in a binary number, the value represents a power of 2. Q17: If reading the byte 0x21 as an ASCII character, what character would it mean? -Answer: +Answer: ! Q18: If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? -Answer: +Answer: It represents 33, which is in the range of 0–255 from dark to light. This value represents a very dark grey. Q19: If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be? -Answer: +Answer: three one-byte => +AA | 00 | FF ==> AA : 10 * 16 + 10 * 1 = 170 | 00 : 0 * 16 + 0 * 1 = 0 | FF : 15 * 16 + 15 * 1 = 255 +so it reperesnt 170, 0, 255 Q20: If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? -Answer: +Answer: AA => 170 Red, 00 => 0 green , FF : 255 is blue From ad6bc8ea9952e0efad0607ee8f1d2335c08d52e5 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 13:05:36 +0100 Subject: [PATCH 11/16] updated branch --- individual-shell-tools/awk/script-01.sh | 2 -- individual-shell-tools/awk/script-02.sh | 2 -- individual-shell-tools/awk/script-03.sh | 2 -- individual-shell-tools/awk/script-04.sh | 2 -- individual-shell-tools/awk/script-05.sh | 2 -- individual-shell-tools/cat/script-01.sh | 2 -- individual-shell-tools/cat/script-02.sh | 2 -- individual-shell-tools/cat/script-03.sh | 2 -- individual-shell-tools/cat/script-04-stretch.sh | 2 -- individual-shell-tools/grep/script-01.sh | 2 -- individual-shell-tools/grep/script-02.sh | 2 -- individual-shell-tools/grep/script-03.sh | 2 -- individual-shell-tools/grep/script-04.sh | 2 -- individual-shell-tools/grep/script-05.sh | 2 -- individual-shell-tools/grep/script-06.sh | 2 -- individual-shell-tools/grep/script-07.sh | 2 -- individual-shell-tools/ls/script-01.sh | 3 +-- individual-shell-tools/ls/script-02.sh | 2 -- individual-shell-tools/ls/script-03.sh | 2 -- individual-shell-tools/ls/script-04.sh | 4 ---- individual-shell-tools/sed/script-01.sh | 2 -- individual-shell-tools/sed/script-02.sh | 2 -- individual-shell-tools/sed/script-03.sh | 2 -- individual-shell-tools/sed/script-04.sh | 2 -- individual-shell-tools/sed/script-05.sh | 2 -- individual-shell-tools/sed/script-06.sh | 2 -- individual-shell-tools/wc/script-01.sh | 2 -- individual-shell-tools/wc/script-02.sh | 2 -- individual-shell-tools/wc/script-03.sh | 2 -- 29 files changed, 1 insertion(+), 60 deletions(-) diff --git a/individual-shell-tools/awk/script-01.sh b/individual-shell-tools/awk/script-01.sh index 587ed2acb..8db4390af 100755 --- a/individual-shell-tools/awk/script-01.sh +++ b/individual-shell-tools/awk/script-01.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in `scores-table.txt`. # Your output should contain 6 lines, each with just one word on it. - -awk '{print $1}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/awk/script-02.sh b/individual-shell-tools/awk/script-02.sh index a29bbbf1f..5956be9bd 100755 --- a/individual-shell-tools/awk/script-02.sh +++ b/individual-shell-tools/awk/script-02.sh @@ -4,5 +4,3 @@ set -euo pipefail # 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, separated by a space. - -awk '{print $1, $2}' scores-table.txt diff --git a/individual-shell-tools/awk/script-03.sh b/individual-shell-tools/awk/script-03.sh index 67365bfa4..af7c6e8b9 100755 --- a/individual-shell-tools/awk/script-03.sh +++ b/individual-shell-tools/awk/script-03.sh @@ -5,5 +5,3 @@ 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". - -awk '{print $1, $3}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/awk/script-04.sh b/individual-shell-tools/awk/script-04.sh index 79da3d066..bf15703c7 100755 --- a/individual-shell-tools/awk/script-04.sh +++ b/individual-shell-tools/awk/script-04.sh @@ -5,5 +5,3 @@ set -euo pipefail # TODO: Write a command to output just the names of each player in London along with the score from their last attempt. # Your output should contain 3 lines, each with one word and one number on it. # The first line should be "Ahmed 4". - -awk '$2 == "London" {print $1, $NF}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/awk/script-05.sh b/individual-shell-tools/awk/script-05.sh index 0df43b872..d1680cb02 100755 --- a/individual-shell-tools/awk/script-05.sh +++ b/individual-shell-tools/awk/script-05.sh @@ -5,5 +5,3 @@ 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". - -awk '{print $1, NF-2}' scores-table.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-01.sh b/individual-shell-tools/cat/script-01.sh index da5ec5029..c85053e0f 100755 --- a/individual-shell-tools/cat/script-01.sh +++ b/individual-shell-tools/cat/script-01.sh @@ -4,5 +4,3 @@ 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...". - -cat ../helper-files/helper-1.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-02.sh b/individual-shell-tools/cat/script-02.sh index f645a1aff..01bbd5eab 100755 --- a/individual-shell-tools/cat/script-02.sh +++ b/individual-shell-tools/cat/script-02.sh @@ -11,5 +11,3 @@ set -euo pipefail # It looked delicious. # I was tempted to take a bite of it. # But this seemed like a bad idea... - -cat ../helper-files/*.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-03.sh b/individual-shell-tools/cat/script-03.sh index e4e7c7fe3..37573b0c1 100755 --- a/individual-shell-tools/cat/script-03.sh +++ b/individual-shell-tools/cat/script-03.sh @@ -9,5 +9,3 @@ 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... - -cat -n ../helper-files/helper-3.txt \ No newline at end of file diff --git a/individual-shell-tools/cat/script-04-stretch.sh b/individual-shell-tools/cat/script-04-stretch.sh index 9ba3dfeb2..00fe3c48b 100755 --- a/individual-shell-tools/cat/script-04-stretch.sh +++ b/individual-shell-tools/cat/script-04-stretch.sh @@ -13,5 +13,3 @@ set -euo pipefail # 3 It looked delicious. # 4 I was tempted to take a bite of it. # 5 But this seemed like a bad idea... - -cat ../helper-files/*.txt | cat -n \ No newline at end of file diff --git a/individual-shell-tools/grep/script-01.sh b/individual-shell-tools/grep/script-01.sh index acf8b4a96..fb05f42f2 100755 --- a/individual-shell-tools/grep/script-01.sh +++ b/individual-shell-tools/grep/script-01.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt said by the Doctor. # The output should contain 6 lines. - -grep ^Doctor: dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-02.sh b/individual-shell-tools/grep/script-02.sh index e05ea7ca6..df6f85640 100755 --- a/individual-shell-tools/grep/script-02.sh +++ b/individual-shell-tools/grep/script-02.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the word Doctor (regardless of case). # The output should contain 9 lines. - -grep -i Doctor dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-03.sh b/individual-shell-tools/grep/script-03.sh index a6fef46f2..5383fe578 100755 --- a/individual-shell-tools/grep/script-03.sh +++ b/individual-shell-tools/grep/script-03.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output the number of lines in dialogue.txt that contain the word Doctor (regardless of case). # The output should be exactly the number 9. - -grep -ic Doctor dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-04.sh b/individual-shell-tools/grep/script-04.sh index 24bb2dfd7..80ee04776 100755 --- a/individual-shell-tools/grep/script-04.sh +++ b/individual-shell-tools/grep/script-04.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that does not contain the word "Hello" (regardless of case). # The output should contain 10 lines. - -grep -iv Hello dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-05.sh b/individual-shell-tools/grep/script-05.sh index 497a6e7f0..1eb538185 100755 --- a/individual-shell-tools/grep/script-05.sh +++ b/individual-shell-tools/grep/script-05.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output every line in dialogue.txt that contains the string "cure", as well as the line before that line. # The output should contain two pairs of two lines of text (with a separator between them). - -grep -B 1 "cure" dialogue.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-06.sh b/individual-shell-tools/grep/script-06.sh index c5b842195..5670e3b6c 100755 --- a/individual-shell-tools/grep/script-06.sh +++ b/individual-shell-tools/grep/script-06.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output the name of every `.txt` file in this directory which contains a line of dialogue said by the Doctor. # The output should contain two filenames. - -grep -l ^Doctor: *.txt \ No newline at end of file diff --git a/individual-shell-tools/grep/script-07.sh b/individual-shell-tools/grep/script-07.sh index 2ebba084b..9670ebad9 100755 --- a/individual-shell-tools/grep/script-07.sh +++ b/individual-shell-tools/grep/script-07.sh @@ -4,5 +4,3 @@ 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. - -grep -c ^Doctor: *.txt diff --git a/individual-shell-tools/ls/script-01.sh b/individual-shell-tools/ls/script-01.sh index 8f93bb79e..754a44837 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -12,6 +12,5 @@ if [[ "${script_dir}" != "$(pwd)" ]]; then fi # TODO: Write a command to list the files and folders in this directory. -# The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. -ls \ No newline at end of file +# The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. \ No newline at end of file diff --git a/individual-shell-tools/ls/script-02.sh b/individual-shell-tools/ls/script-02.sh index b026cfd6c..d0a5a10f4 100755 --- a/individual-shell-tools/ls/script-02.sh +++ b/individual-shell-tools/ls/script-02.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command which lists all of the files in the directory named child-directory. # The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt. - -ls child-directory diff --git a/individual-shell-tools/ls/script-03.sh b/individual-shell-tools/ls/script-03.sh index b259fcb1d..781216d21 100755 --- a/individual-shell-tools/ls/script-03.sh +++ b/individual-shell-tools/ls/script-03.sh @@ -5,5 +5,3 @@ set -euo pipefail # TODO: Write a command which _recursively_ lists all of the files and folders in this directory _and_ all of the files inside those folders. # The output should be a list of names including: child-directory, script-01.sh, helper-1.txt (and more). # The formatting of the output doesn't matter. - -ls -R \ No newline at end of file diff --git a/individual-shell-tools/ls/script-04.sh b/individual-shell-tools/ls/script-04.sh index 061b4f3d0..72f3817b3 100755 --- a/individual-shell-tools/ls/script-04.sh +++ b/individual-shell-tools/ls/script-04.sh @@ -16,12 +16,8 @@ echo "First exercise (sorted newest to oldest):" # TODO: Write a command which lists the files in the child-directory directory, one per line, sorted so that the most recently modified file is first. # The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt. -ls -1t child-directory - echo "Second exercise (sorted oldest to newest):" # TODO: Write a command which does the same as above, but sorted in the opposite order (oldest first). # The output should be a list of names in this order, one per line: helper-2.txt, helper-1.txt, helper-3.txt. - -ls -1tr child-directory \ No newline at end of file diff --git a/individual-shell-tools/sed/script-01.sh b/individual-shell-tools/sed/script-01.sh index 0bd78a317..d592970fc 100755 --- a/individual-shell-tools/sed/script-01.sh +++ b/individual-shell-tools/sed/script-01.sh @@ -5,5 +5,3 @@ 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.". - -sed 's/i/I/g' input.txt \ No newline at end of file diff --git a/individual-shell-tools/sed/script-02.sh b/individual-shell-tools/sed/script-02.sh index 0f32ffd6b..abdd64d06 100755 --- a/individual-shell-tools/sed/script-02.sh +++ b/individual-shell-tools/sed/script-02.sh @@ -5,5 +5,3 @@ set -euo pipefail # TODO: Write a command to output input.txt with numbers removed. # The output should contain 11 lines. # Line 6 of the output should be " Alisha". - -sed 's/[0-9]*//g' input.txt \ No newline at end of file diff --git a/individual-shell-tools/sed/script-03.sh b/individual-shell-tools/sed/script-03.sh index e70f4a600..dd284a296 100755 --- a/individual-shell-tools/sed/script-03.sh +++ b/individual-shell-tools/sed/script-03.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output input.txt removing any line which contains a number. # The output should contain 6 lines. - -sed '/[0-9]/d' input.txt diff --git a/individual-shell-tools/sed/script-04.sh b/individual-shell-tools/sed/script-04.sh index 8ac6e7c5d..0052ac6c4 100755 --- a/individual-shell-tools/sed/script-04.sh +++ b/individual-shell-tools/sed/script-04.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output input.txt replacing every occurrence of the string "We'll" with "We will". # The output should contain 11 lines. - -sed "s/We'll/We will/g" input.txt diff --git a/individual-shell-tools/sed/script-05.sh b/individual-shell-tools/sed/script-05.sh index 990ac2f2c..2dcc91a0c 100755 --- a/individual-shell-tools/sed/script-05.sh +++ b/individual-shell-tools/sed/script-05.sh @@ -6,5 +6,3 @@ set -euo pipefail # If a line starts with a number and a space, make the line instead end with a space and the number. # So line 6 which currently reads "37 Alisha" should instead read "Alisha 37". # The output should contain 11 lines. - -sed -E 's/^([0-9]+) (.*)$/\2 \1/' input.txt diff --git a/individual-shell-tools/sed/script-06.sh b/individual-shell-tools/sed/script-06.sh index ab15800eb..0b9390170 100755 --- a/individual-shell-tools/sed/script-06.sh +++ b/individual-shell-tools/sed/script-06.sh @@ -8,5 +8,3 @@ 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.". - -sed 's/, */, /g' input.txt \ No newline at end of file diff --git a/individual-shell-tools/wc/script-01.sh b/individual-shell-tools/wc/script-01.sh index 22b7b8d9e..c9dd6e5df 100755 --- a/individual-shell-tools/wc/script-01.sh +++ b/individual-shell-tools/wc/script-01.sh @@ -4,5 +4,3 @@ 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 \ No newline at end of file diff --git a/individual-shell-tools/wc/script-02.sh b/individual-shell-tools/wc/script-02.sh index ae2ae870b..8feeb1a62 100755 --- a/individual-shell-tools/wc/script-02.sh +++ b/individual-shell-tools/wc/script-02.sh @@ -4,5 +4,3 @@ set -euo pipefail # TODO: Write a command to output the number of lines in the file helper-files/helper-3.txt. # The output should include the number 3. The output should not include the number 19. - -wc -l ../helper-files/helper-3.txt diff --git a/individual-shell-tools/wc/script-03.sh b/individual-shell-tools/wc/script-03.sh index 3bc287a1a..6b2e9d3d1 100755 --- a/individual-shell-tools/wc/script-03.sh +++ b/individual-shell-tools/wc/script-03.sh @@ -8,5 +8,3 @@ set -euo pipefail # 1 7 39 ../helper-files/helper-2.txt # 3 19 92 ../helper-files/helper-3.txt # 5 30 151 total - -wc ../helper-files/*.txt \ No newline at end of file From b6324e43bb4a2e65ac52046b6bb4dd410b73fd35 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 13:14:21 +0100 Subject: [PATCH 12/16] remove changes on main branch --- number-systems/Part-1.md | 32 ++++++++++++++++---------------- number-systems/Part-2.md | 12 +++++------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/number-systems/Part-1.md b/number-systems/Part-1.md index 68b77ea0b..d8f9c290e 100644 --- a/number-systems/Part-1.md +++ b/number-systems/Part-1.md @@ -6,49 +6,49 @@ The goal of these exercises is for you to gain an intuition for binary numbers. The answers to these questions should be a number, either in binary, hex, or decimal. -Q1: Convert the decimal number 14 to binary. 0,2,4,8,16,32,64,128,256 -Answer: 1110 +Q1: Convert the decimal number 14 to binary. +Answer: Q2: Convert the binary number 101101 to decimal: -Answer: 45 +Answer: Q3: Which is larger: 1000 or 0111? -Answer: 1000 +Answer: Q4: Which is larger: 00100 or 01011? -Answer: 01011 +Answer: Q5: What is 10101 + 01010? -Answer: 11111 +Answer: Q6: What is 10001 + 10001? -Answer: 100010 +Answer: Q7: What's the largest number you can store with 4 bits, if you want to be able to represent the number 0? -Answer: 15 +Answer: Q8: How many bits would you need in order to store the numbers between 0 and 255 inclusive? -Answer: 9 +Answer: Q9: How many bits would you need in order to store the numbers between 0 and 3 inclusive? -Answer: 2 +Answer: Q10: How many bits would you need in order to store the numbers between 0 and 1000 inclusive? -Answer: 10 +Answer: Q11: Convert the decimal number 14 to hex. -Answer: E +Answer: Q12: Convert the decimal number 386 to hex. -Answer: 182 +Answer: Q13: Convert the hex number 386 to decimal. -Answer: 902 +Answer: Q14: Convert the hex number B to decimal. -Answer: 11 +Answer: Q15: If reading the byte 0x21 as a number, what decimal number would it mean? -Answer: 33 +Answer: Q16: Continues in Part-2 diff --git a/number-systems/Part-2.md b/number-systems/Part-2.md index 1fce42ee7..68b0933d9 100644 --- a/number-systems/Part-2.md +++ b/number-systems/Part-2.md @@ -7,18 +7,16 @@ The goal of these exercises is for you to gain an intuition for binary numbers. The answers to these questions will require a bit of explanation, not just a simple answer. Q16: How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)? -Answer: If there is just one 1 in a binary number, then it is a power of 2. This is because each bit represents a power of 2, so if there is just one 1 bit in a binary number, the value represents a power of 2. +Answer: Q17: If reading the byte 0x21 as an ASCII character, what character would it mean? -Answer: ! +Answer: Q18: If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? -Answer: It represents 33, which is in the range of 0–255 from dark to light. This value represents a very dark grey. +Answer: Q19: If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be? -Answer: three one-byte => -AA | 00 | FF ==> AA : 10 * 16 + 10 * 1 = 170 | 00 : 0 * 16 + 0 * 1 = 0 | FF : 15 * 16 + 15 * 1 = 255 -so it reperesnt 170, 0, 255 +Answer: Q20: If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? -Answer: AA => 170 Red, 00 => 0 green , FF : 255 is blue +Answer: From 31364b4bb140180269c9b2a8aaa009071f7f6e9a Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 13:48:49 +0100 Subject: [PATCH 13/16] update script-01 file to be unchaged on main branch --- individual-shell-tools/ls/script-01.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/individual-shell-tools/ls/script-01.sh b/individual-shell-tools/ls/script-01.sh index 754a44837..3e5cb6eed 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -12,5 +12,4 @@ if [[ "${script_dir}" != "$(pwd)" ]]; then fi # TODO: Write a command to list the files and folders in this directory. - # The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. \ No newline at end of file From ebca147ad05ff59d69f3fe3f9bfc1ff824b6b812 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 17:52:45 +0100 Subject: [PATCH 14/16] fix unwanted file chnage --- individual-shell-tools/ls/script-01.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/individual-shell-tools/ls/script-01.sh b/individual-shell-tools/ls/script-01.sh index 3e5cb6eed..241b62f5e 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -12,4 +12,4 @@ if [[ "${script_dir}" != "$(pwd)" ]]; then fi # TODO: Write a command to list the files and folders in this directory. -# The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. \ No newline at end of file +# The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. From 7cc0b393b5a41c4d4f3a38aa95bfe3ddd8c41fc2 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 19:19:20 +0100 Subject: [PATCH 15/16] jq exersice --- jq/script-01.sh | 2 ++ jq/script-02.sh | 2 ++ jq/script-03.sh | 2 ++ jq/script-04.sh | 2 ++ jq/script-05.sh | 2 ++ jq/script-06.sh | 2 ++ jq/script-07.sh | 2 ++ jq/script-08.sh | 1 + jq/script-09.sh | 1 + jq/script-10.sh | 2 ++ jq/script-11.sh | 1 + 11 files changed, 19 insertions(+) diff --git a/jq/script-01.sh b/jq/script-01.sh index 95827f688..5597c3a7d 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 ' .name' person.json \ No newline at end of file diff --git a/jq/script-02.sh b/jq/script-02.sh index 21544d67b..c1d25ab82 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 -r '.address | join(", ")' person.json \ No newline at end of file diff --git a/jq/script-03.sh b/jq/script-03.sh index 3566f03ba..880729fac 100755 --- a/jq/script-03.sh +++ b/jq/script-03.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, 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] | join(", ")' person.json \ No newline at end of file diff --git a/jq/script-04.sh b/jq/script-04.sh index 015997e18..756dd6702 100755 --- a/jq/script-04.sh +++ b/jq/script-04.sh @@ -6,3 +6,5 @@ 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 993fc9ee3..b2c9516ae 100755 --- a/jq/script-05.sh +++ b/jq/script-05.sh @@ -5,3 +5,5 @@ 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 -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 8b6e74c52..e5ee12f31 100755 --- a/jq/script-06.sh +++ b/jq/script-06.sh @@ -6,3 +6,5 @@ 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]] | join(" ")' scores.json \ No newline at end of file diff --git a/jq/script-07.sh b/jq/script-07.sh index d43f93d1b..69aabb70b 100755 --- a/jq/script-07.sh +++ b/jq/script-07.sh @@ -6,3 +6,5 @@ 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]] | join(" ")' scores.json \ No newline at end of file diff --git a/jq/script-08.sh b/jq/script-08.sh index 6671fd1ba..b92720686 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)] | join(" ")' scores.json \ No newline at end of file diff --git a/jq/script-09.sh b/jq/script-09.sh index c2536a536..757de440d 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)] | join(" ")' scores.json \ No newline at end of file diff --git a/jq/script-10.sh b/jq/script-10.sh index 8e9d75f07..aca53e747 100755 --- a/jq/script-10.sh +++ b/jq/script-10.sh @@ -5,3 +5,5 @@ 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 d2337a6b2..a55d91c16 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 \ No newline at end of file From 0fdfc3f639c71919d4e2f5bddc54f7d71ce3e8d4 Mon Sep 17 00:00:00 2001 From: Boshra Mahmoudi Date: Tue, 28 Jul 2026 19:36:13 +0100 Subject: [PATCH 16/16] fix the problem in script1 --- jq/script-01.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jq/script-01.sh b/jq/script-01.sh index 5597c3a7d..5b93f5852 100755 --- a/jq/script-01.sh +++ b/jq/script-01.sh @@ -6,4 +6,4 @@ set -euo pipefail # 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 ' .name' person.json \ No newline at end of file +jq -r '.name' person.json \ No newline at end of file