| 1 | #!/bin/sh
|
| 2 |
|
| 3 | set -eu
|
| 4 | RED="\033[31m"
|
| 5 | GREEN="\033[32m"
|
| 6 | RESET="\033[0m"
|
| 7 |
|
| 8 | cleanup() {
|
| 9 | [ -d "blueberry" ] && rm -rf blueberry
|
| 10 | }
|
| 11 | trap cleanup EXIT
|
| 12 |
|
| 13 | failed() {
|
| 14 | printf "${RED}Failed${RESET}\n"
|
| 15 | exit 1
|
| 16 | }
|
| 17 |
|
| 18 | mkdir -p blueberry/strawberry/grape/lemon
|
| 19 | mkdir -p blueberry/strawberry/cherry/
|
| 20 |
|
| 21 | touch blueberry/strawberry/grape/lemon/.you_found_me.txt
|
| 22 | echo "The password is grannyApples" > blueberry/strawberry/grape/lemon/.you_found_me.txt
|
| 23 |
|
| 24 | echo "Find the grape folder, the file with the password might"
|
| 25 | echo "be hard to find, but it is there."
|
| 26 |
|
| 27 | if [ "$(sh exercises/04_navigation.sh)" = "grannyApples" ]; then
|
| 28 | printf "${GREEN}Passed${RESET}\n"
|
| 29 | else
|
| 30 | failed
|
| 31 | fi
|