shelllings |
git clone https://git.davidvoz.net/shelllings.git
|
| 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | RED="\033[31m" |
| 5 | GREEN="\033[32m" |
| 6 | RESET="\033[0m" |
| 7 | |
| 8 | failed() { |
| 9 | printf "${RED}Failed${RESET}\n" |
| 10 | exit 1 |
| 11 | } |
| 12 | |
| 13 | [ "$(sh exercises/14_conditionals.sh)" != "Password not entered" ] && failed # no password entered |
| 14 | [ "$(sh exercises/14_conditionals.sh password123)" != "Welcome" ] && failed # correct password |
| 15 | [ "$(sh exercises/14_conditionals.sh password)" != "Access not granted" ] && failed # incorrectpassword |
| 16 | |
| 17 | printf "${GREEN}Passed${RESET}\n" |