Daily Shaarli

All links of one day in a single page.

April 15, 2019

quirk/README.md at master · Flaque/quirk · GitHub
thumbnail
bash is silent about which line the script died at (if set -e)

waterhouse 2 days ago | parent [-] | on: I got tired of PHP and Perl, so I tried bash

$ cat meh.bash

!/bin/bash

set -e
die() {
echo "Failed at line $1: $2"
}
trap 'die $LINENO "$BASH_COMMAND"' ERR
echo a
test 1 = 3
echo b

$ ./meh.bash
a
Failed at line 8: test 1 = 3
Adapted from: https://unix.stackexchange.com/a/462157