fix(right) fixing the test, readme and solution

This commit is contained in:
miguel 2023-01-16 16:30:34 +00:00 committed by MSilva95
parent 21a6aace01
commit 5ffb2348f5
7 changed files with 16 additions and 6 deletions

View File

View File

View File

@ -8,11 +8,21 @@ IFS='
FILENAME="student/right.sh" FILENAME="student/right.sh"
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
if test ! -e right; then
mkdir right
cd right
touch sample1.txt sample2 sample3.txt sample4
cd ..
fi
challenge() { challenge() {
submitted=$(cd "$1" && bash "$script_dirS"/$FILENAME) $(cd "$1" && bash "$script_dirS"/$FILENAME)
expected=$(cd "$1" && bash "$script_dirS"/solutions/right.sh) submitted=$(cat $1/filtered_files.txt)
rm $1"/filtered_files.txt"
$(cd "$1" && bash "$script_dirS"/solutions/right.sh)
expected=$(cat $1/filtered_files.txt)
diff <(echo "$submitted") <(echo "$expected") diff <(echo "$submitted") <(echo "$expected")
diff $1"/filtered_files_sol.txt" $1"/filtered_files.txt"
} }
challenge right challenge right
rm -r right

View File

@ -1 +1 @@
ls | grep -v "\.txt" >filtered_files_sol.txt ls | grep -v "\.txt" >filtered_files.txt

View File

@ -20,9 +20,9 @@ $
### Hints ### Hints
command1 | command2 > output_file `command1 | command2 > output_file`
Here, command1 is the command that generates the output you want to parse, and command2 is the command that parses the output. The output of command2 will be redirected to the file output_file using the > operator. Here, `command1` is the command that generates the output you want to parse, and `command2` is the command that parses the output. The output of `command2` will be redirected to the file `output_file` using the `>` operator.
> You have to use Man or Google to know more about commands flags, in order to solve this exercise! > You have to use Man or Google to know more about commands flags, in order to solve this exercise!
> Google and Man will be your friends! > Google and Man will be your friends!