shelllings

a practical way to learn shell
Log | Files | Refs | README | LICENSE

23_man_and_tips.sh (317B)


      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 check() {
     14 	read amount_cat
     15 	read amount_ls
     16 
     17 	[ "$amount_cat" -eq 73 ] || failed
     18 	[ "$amount_ls" -eq 867 ] || failed
     19 }
     20 
     21 sh exercises/23_man_and_tips.sh | check
     22 
     23 printf "${GREEN}Passed${RESET}\n"