declare -rg MYPID=$$ perror() { echo "[ERROR] *" "$@" [ "$$" != "$MYPID" ] && kill "$MYPID" exit 1 } pwarning() { echo "[WARNING] *" "$@" }