feat(user):Script to get gpg fingerprints from git dir
[BK-2020-03.git] / unitproc / bktemp-yellDieTry
CommitLineData
0ed005b0
SBS
1#!/bin/bash
2# Desc: Defines bash functions yell(), die(), and try(), which are useful for
3# indicating where in a script an error occurs.
831b1cb4 4# Note: All three functions should be added together if used at all.
0ed005b0
SBS
5# Ref/Attrib: [1] Yell, Die, Try Three-Fingered Claw technique https://stackoverflow.com/a/25515370
6# Depends: GNU Coreutils 8.30
831b1cb4 7# Version 0.1.1
0ed005b0
SBS
8
9#==BEGIN Define script parameters==
10#==END Define script parameters==
11
12#===BEGIN Declare local script functions===
831b1cb4
SBS
13yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
14die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
15try() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
0ed005b0
SBS
16#===END Declare local script functions===
17
18#==BEGIN sample code==
19yell "This message should appear in stderr.";
20try echo "This message should appear in stdout.";
21try eeeecho "This message should appear in an error message in stderr.";
22yell "This message should not appear because \"try eeeecho\" failed.";
23#==END sample code==