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 | cleanup(){ |
| 9 | [ -f "10_piping" ] && rm 09_piping |
| 10 | [ -f "file" ] && rm file |
| 11 | } |
| 12 | trap cleanup EXIT |
| 13 | |
| 14 | failed() { |
| 15 | printf "${RED}Failed${RESET}\n" |
| 16 | exit 1 |
| 17 | } |
| 18 | |
| 19 | [ $(grep "cat LICENSE | wc -w" exercises/10_piping.sh | wc -l) -eq 0 ] && failed |
| 20 | |
| 21 | [ $(grep "ls -A \"\$HOME\" | wc -l" exercises/10_piping.sh | wc -l) -eq 1 ] || failed |
| 22 | |
| 23 | printf "${GREEN}Passed${RESET}\n" |