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 "LICENSE.gz" ] && rm LICENSE.gz |
| 10 | } |
| 11 | trap cleanup EXIT |
| 12 | |
| 13 | failed() { |
| 14 | printf "${RED}Failed${RESET}\n" |
| 15 | exit 1 |
| 16 | } |
| 17 | |
| 18 | sh exercises/29_gzip.sh || failed |
| 19 | |
| 20 | [ -s LICENSE.gz ] || failed |
| 21 | [ -s LICENSE ] || failed |
| 22 | |
| 23 | leis_size=$(stat -c%s LICENSE) |
| 24 | gz_size=$(stat -c%s LICENSE.gz) |
| 25 | |
| 26 | [ $leis_size -gt $gz_size ] || failed |
| 27 | |
| 28 | printf "${GREEN}Passed${RESET}\n" |