Browse Source

fix(right) fixing the test, readme and solution

pull/1720/head
miguel 2 years ago committed by MSilva95
parent
commit
5ffb2348f5
  1. 0
      sh/tests/right/sample1.txt
  2. 0
      sh/tests/right/sample2
  3. 0
      sh/tests/right/sample3.txt
  4. 0
      sh/tests/right/sample4
  5. 16
      sh/tests/right_test.sh
  6. 2
      sh/tests/solutions/right.sh
  7. 4
      subjects/devops/right/README.md

16
sh/tests/right_test.sh

@ -8,11 +8,21 @@ IFS='
FILENAME="student/right.sh"
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() {
submitted=$(cd "$1" && bash "$script_dirS"/$FILENAME)
expected=$(cd "$1" && bash "$script_dirS"/solutions/right.sh)
$(cd "$1" && bash "$script_dirS"/$FILENAME)
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 $1"/filtered_files_sol.txt" $1"/filtered_files.txt"
}
challenge right
rm -r right

2
sh/tests/solutions/right.sh

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

4
subjects/devops/right/README.md

@ -20,9 +20,9 @@ $
### 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!
> Google and Man will be your friends!

Loading…
Cancel
Save