shelllings

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

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