mirror of https://github.com/01-edu/public.git
Zouhair AMAZZAL
2 years ago
committed by
Zouhair AMAZZAL
25 changed files with 68 additions and 0 deletions
@ -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 |
@ -0,0 +1,3 @@
|
||||
#!/bin/bash |
||||
|
||||
find . \( -name 'a*' -or -type f -name '*z' \) |
@ -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…
Reference in new issue