13_copying_and_moving.sh (343B)
1 #!/bin/sh 2 3 set -eu 4 RED="\033[31m" 5 GREEN="\033[32m" 6 RESET="\033[0m" 7 8 failed() { 9 [ -f "11_file" ] && rm 11_file 10 [ -f "11_user_input" ] && rm 11_user_input 11 printf "${RED}Failed${RESET}\n" 12 exit 1 13 } 14 trap failed EXIT 15 16 sh exercises/13_copying_and_moving.sh 17 18 [ -f "11_file" ] && failed 19 20 [ -s "11_user_input" ] && printf "${GREEN}Passed${RESET}\n"