From 7d96fb89fdb1e986b15a8694f8e570f29c4a36d5 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 9 Dec 2021 13:51:17 +0000 Subject: [PATCH] simplification of subject teacher, removal of loop and focus on environment variables --- sh/tests/solutions/teacher.sh | 5 ++--- subjects/teacher/README.md | 22 ++++++---------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/sh/tests/solutions/teacher.sh b/sh/tests/solutions/teacher.sh index 42295d49..0b0350b1 100755 --- a/sh/tests/solutions/teacher.sh +++ b/sh/tests/solutions/teacher.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash INTERVIEWNUMBER=$(head -n 179 streets/Buckingham_Place | tail -n 1 | cut -d "#" -f2) -echo "$INTERVIEWNUMBER" +echo $INTERVIEWNUMBER cat interviews/interview-"$INTERVIEWNUMBER" -grep -A 4 L337 vehicles | grep -A 3 -B 1 Honda | grep -A 2 -B 2 Blue | grep -B 4 "Height: 6" -cat memberships/AAA memberships/Delta_SkyMiles memberships/Museum_of_Bash_History memberships/Terminal_City_Library| grep "$MAIN_SUSPECT" | wc -l +echo $MAIN_SUSPECT diff --git a/subjects/teacher/README.md b/subjects/teacher/README.md index 72094859..b49dc749 100644 --- a/subjects/teacher/README.md +++ b/subjects/teacher/README.md @@ -2,30 +2,20 @@ ### Instructions -"let's play!" +"I need this report!" "A **true teacher** does not jealously guard his mastery." The commissioner was most impressed by the result of your answers. -He has now asked your help to create a training program for the future police inspectors. You gladly accept as you think that this will help lessen your burden of fighting crime in the future. +He has now asked your help to create a training program that will be based on your report for the future police inspectors. In a training folder, various folders `mystery` were prepared with some key differences in the data for each group of trainees. (those folders will not be called `mystery`, they will have different names but they will all be at the same level) To simplify your life as a teacher and as the answers will not be exactly the same in each `mystery` folder, you need to write a `teacher.sh` file that does the following: -- step 1, it enters the `mystery` folder.(again, the names will vary) -- step 2, it isolates, through a similar command that you used to find it, and into an environment variable, the number (**and only the number**) of the key interview that helped solved the mystery (Unlike the interview number, the address will not change across the `mystery` folders that will be tested, hence the command to find the interview is the same across all the `mystery` folders that will be tested). -- step 3, it prints the newly created environment variable. -- step 4, it prints what the interview contains. -- step 5, it executes the command that should have printed the short list of 4 suspects. (it only shows the license Plate, the Make, the Color, the Owner, and the Height) -- step 6, it executes the command that should have gotten your main suspect convicted (as a reminder the result of that command should be the printing of a number) except that now you replace your suspect name with the environment variable MAIN_SUSPECT. - -- step 7, step 1 to 6 are repeated for each `mystery` folder of the training folder that the program works in. - -Note that for **step 2 to 6**, all the commands have to be executed with keeping in mind that the `mystery` folder is the current directory but that its name will vary. +- step 1, it isolates, into an environment variable and through a similar command that you used to find it, the number (**and only the number**) of the key interview that helped solved the mystery (Unlike the interview number, the path will not change across the `mystery` folders that will be tested, hence the command to find the interview is the same across all the `mystery` folders that will be tested). +- step 2, it prints the newly created environment variable. +- step 3, it prints what the interview contains. +- step 4, it prints the content of the environment variable MAIN_SUSPECT. Now show them who is the boss... - -### Hint - -Search how to do a loop with a `.sh` file now.