Browse Source

feat(find-files): add subject, test and solution for new a exercise

pull/1637/head
Zouhair AMAZZAL 2 years ago committed by Zouhair AMAZZAL
parent
commit
cabe2e248f
  1. 0
      sh/tests/find-files/folder1/ab
  2. 0
      sh/tests/find-files/folder1/ac
  3. 0
      sh/tests/find-files/folder1/az
  4. 0
      sh/tests/find-files/folder1/bz
  5. 0
      sh/tests/find-files/folder1/cz
  6. 0
      sh/tests/find-files/folder1/za!
  7. 0
      sh/tests/find-files/folder2/aa/aa
  8. 0
      sh/tests/find-files/folder2/aa/az
  9. 0
      sh/tests/find-files/folder2/aa/ba/ab
  10. 0
      sh/tests/find-files/folder2/aa/ba/bz
  11. 0
      sh/tests/find-files/folder2/ab
  12. 0
      sh/tests/find-files/folder2/ac
  13. 0
      sh/tests/find-files/folder2/alphabet
  14. 0
      sh/tests/find-files/folder2/az
  15. 0
      sh/tests/find-files/folder2/ba/aa/alphabetz!
  16. 0
      sh/tests/find-files/folder2/ba/aa/cz
  17. 0
      sh/tests/find-files/folder2/ba/aa/za!
  18. 0
      sh/tests/find-files/folder2/ba/ac
  19. 0
      sh/tests/find-files/folder2/ba/alphabetz
  20. 0
      sh/tests/find-files/folder2/bz
  21. 0
      sh/tests/find-files/folder2/cz
  22. 0
      sh/tests/find-files/folder2/za!
  23. 18
      sh/tests/find-files_test.sh
  24. 3
      sh/tests/solutions/find-files.sh
  25. 47
      subjects/find-files/README.md

0
sh/tests/find-files/folder2/aa/ba/ab

0
sh/tests/find-files/folder2/aa/ba/bz

0
sh/tests/find-files/folder2/alphabet

0
sh/tests/find-files/folder2/ba/aa/alphabetz!

0
sh/tests/find-files/folder2/ba/aa/cz

0
sh/tests/find-files/folder2/ba/aa/za!

0
sh/tests/find-files/folder2/ba/alphabetz

18
sh/tests/find-files_test.sh

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Unofficial Bash Strict Mode
set -euo pipefail
IFS='
'
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
submitted=$(cd "$1" && bash "$script_dirS"/student/find-files.sh)
expected=$(cd "$1" && bash "$script_dirS"/solutions/find-files.sh)
diff <(echo "$submitted") <(echo "$expected")
}
challenge find-files/folder1
challenge find-files/folder2

3
sh/tests/solutions/find-files.sh

@ -0,0 +1,3 @@
#!/bin/bash
find . \( -name 'a*' -or -type f -name '*z' \)

47
subjects/find-files/README.md

@ -0,0 +1,47 @@
## find-files
### Instructions
"start finding ..."
Create a file `find-files.sh`, which will look for and show, in the current directory and its sub-folders:
everything that starts with an `a` or,
all the files ending with a `z` or,
- You can use this for testing: https://assets.01-edu.org/devops-branch/find-files-example.zip
- What to use : `find`
- The output should be exactly like the example bellow but with the expected name
```console
$pwd
<..>/find-files-example
$./find-files.sh
./folder2/zzzz
./folder3/asd
./folder3/sub-folder4/abc
./folder3/sub-folder4/a_correct
./folder3/sub-folder4/aefg
./folder3/asd 2
./folder3/ahmed
./folder1/aolder_lol
$
```
### Hints
`find` command is used to search and locate the list of files and directories based on conditions you specify for files that match the arguments:
```console
$find ~/
<all files and folders in the user home>
$find ~/ \( -type f \)
<all files in the user home>
$
```
> You have to use Man or Google to know more about commands flags, in order to solve this exercice!
> Google and Man will be your friends!
Loading…
Cancel
Save