You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
700 B

#!/bin/bash
function log () {
# if argument is given, echo argument, if stream is piped, echo each line of stream
if [ "$verbosity" != 'VERBOSE' ] ; then return 0; fi
if [ -n "$1" ]; then
echo "$1"
else
while read line
do
if [ -n "$line" ]; then
echo "$line"
fi
done
fi
}
function error () {
# if argument is given, echo argument to stderr, if stream is piped, echo each line of stream to stderr
if [ "$verbosity" = 'SILENT' ]; then return 0; fi
if [ -n "$1" ]; then
echo "$1" >&2
else
while read line
do
if [ -n "$line" ]; then
echo "$line" >&2
fi
done
fi
}