aboutsummaryrefslogtreecommitdiff
path: root/core/lib
blob: 98926632bef00d1a1fb1fa59ebd9b5606c29d9ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
# utility variables and functions
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" # XDG basedir specification

# this variable grows automatically as long as this file is included in each
# subcommand
export subcmd="$subcmd${subcmd:+ }$(basename "$0")"

# print an error to stdout and exit
err() {
	echo "error: $*" >&2
	echo "run \`$subcmd --help\` for options" >&2
	exit 1
}

# debug:
# bc() { tee /dev/stderr | /usr/bin/bc ; }