shelllings

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

20_whileloop.sh (359B)


      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 printf "123\n456\n2987133075769857928\n" | sh exercises/20_whileloop.sh | grep -q "Nope" || failed
     14 printf "123\n456\n2987133075769857928\n" | sh exercises/20_whileloop.sh | grep -q "cheater" || failed
     15 
     16 printf "${GREEN}Passed${RESET}\n"