shelllings

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

03_listing.sh
1#!/bin/sh
2
3set -eu
4RED="\033[31m"
5GREEN="\033[32m"
6RESET="\033[0m"
7
8[ -f ".youfoundme" ] || touch .youfoundme
9
10cleanup() {
11 [ -e .youfoundme ] && rm -f .youfoundme
12}
13trap cleanup EXIT
14
15failed() {
16 printf "${RED}Failed${RESET}\n"
17 exit 1
18}
19
20sh exercises/03_listing.sh || failed
21
22[ -f ".youfoundme" ] && failed
23
24printf "${GREEN}Passed${RESET}\n"