{
  \unalias command
  \unset -f command
} >/dev/null 2>&1

die() {
  if [ -e /dev/stderr ]; then
    printf "\033[31m%s\033[m\n\r" "$*" >/dev/stderr
  elif [ -e /dev/fd/2 ]; then
    printf "\033[31m%s\033[m\n\r" "$*" >/dev/fd/2
  else
    printf "\033[31m%s\033[m\n\r" "$*"
  fi
  exit 1
}

case "$(command uname)" in
  'Linux') OS="linux" ;;
  'Darwin') OS="darwin" ;;
  'FreeBSD') OS="freebsd" ;;
  'NetBSD') OS="netbsd" ;;
  'OpenBSD') OS="openbsd" ;;
  'DragonFlyBSD') OS="dragonfly" ;;
  'Solaris') OS="solaris" ;;
  *) die "$(command uname): unknown operating system" ;;
esac
