shelllings

a practical way to learn shell
git clone https://git.davidvoz.net/shelllings.git
Log | Files | Refs | README | LICENSE

32_find.sh (370B)


      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 sh exercises/32_find.sh || failed
     14 
     15 user_output=$(sh exercises/32_find.sh | sort)
     16 correct_output=$(find . -name .git -prune -o -type f -name "*oo*" -print | sort)
     17 
     18 [ "$user_output" = "$correct_output" ] || failed
     19 
     20 printf "${GREEN}Passed${RESET}\n"