shelllings

a practical way to learn shell
git clone https://git.davidvoz.net/shelllings.git
index
logs
tree
license

15_conditionals2.sh
1#!/bin/sh
2
3set -eu
4RED="\033[31m"
5GREEN="\033[32m"
6RESET="\033[0m"
7
8failed() {
9 printf "${RED}Failed${RESET}\n"
10 exit 1
11}
12
13[ "$(sh exercises/15_conditionals2.sh 10)" = "even" ] || failed
14[ "$(sh exercises/15_conditionals2.sh -1)" = "odd" ] || failed
15[ "$(sh exercises/15_conditionals2.sh -9)" = "odd" ] || failed
16[ "$(sh exercises/15_conditionals2.sh 1000000)" = "even" ] || failed
17
18printf "${GREEN}Passed${RESET}\n"