OILS / stdlib / two.sh View on Github | oilshell.org

23 lines, 7 significant
1# Two functions I actually use, all the time.
2#
3# To keep depenedencies small, this library will NEVER grow other functions
4# (and is named to imply that.)
5#
6# Usage:
7# source --builtin two.sh
8#
9# Examples:
10# log 'hi'
11# die 'expected a number'
12
13log() {
14 ### Write a message to stderr.
15 echo "$@" >&2
16}
17
18die() {
19 ### Write an error message with the script name, and exit failure.
20 log "$0: fatal: $@"
21 exit 1
22}
23