diff options
| author | EuAndreh <eu@euandre.org> | 2022-08-12 23:45:58 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2022-08-12 23:46:24 -0300 |
| commit | a79c3d3c803bc2df2b3d31a02f25710810317ecc (patch) | |
| tree | 79a8b45c8de2a6bd8961c4bae13d7c5bc9ac83ea /bin/with-email | |
| parent | bin/{with-,}email: Add "Examples" section to help string (diff) | |
| download | dotfiles-a79c3d3c803bc2df2b3d31a02f25710810317ecc.tar.gz dotfiles-a79c3d3c803bc2df2b3d31a02f25710810317ecc.tar.xz | |
etc/guix/home.scm: Setup working cronjobs
Diffstat (limited to 'bin/with-email')
| -rwxr-xr-x | bin/with-email | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/bin/with-email b/bin/with-email index dc2a022..7df101a 100755 --- a/bin/with-email +++ b/bin/with-email @@ -69,15 +69,7 @@ while getopts 's:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'COMMAND...' +eval "$(assert-arg "${1:-}" 'COMMAND...')" now() { date '+%Y-%m-%dT%H:%M:%S%Z' @@ -90,10 +82,10 @@ OUT="$(mkstemp)" printf '\n' STATUS=0 - "$@" 2>&1 || STATUS=$? + "$@" || STATUS=$? printf '\n' printf '\nFinished at: %s\n' "$(now)" -} 2>&1 1>"$OUT" +} 1>"$OUT" 2>&1 email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" |
