From fa54644369f72acab351ca78488d9e617f2d12f9 Mon Sep 17 00:00:00 2001 From: Jacob Hrbek Date: Wed, 24 Jul 2019 03:02:06 +0200 Subject: [PATCH] oh-my-bash: Changed extension on .bash --- oh-my-bash.sh => oh-my-bash.bash | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) rename oh-my-bash.sh => oh-my-bash.bash (85%) diff --git a/oh-my-bash.sh b/oh-my-bash.bash similarity index 85% rename from oh-my-bash.sh rename to oh-my-bash.bash index ea93c2902..9e3d77cd1 100644 --- a/oh-my-bash.sh +++ b/oh-my-bash.bash @@ -1,23 +1,13 @@ #!/usr/bin/env bash -# Error handling -## if {einfo,warn,die}() are not set globally (so that end-user can customize the error) then sets script's definitions -if ! command -v einfo > /dev/null; then einfo() { printf "INFO: %s\n" "$1" 1>&2 ; } fi -if ! command -v warn > /dev/null; then warn() { printf "WARN: %s\n" "$1" 1>&2 ; } fi -if ! command -v die > /dev/null; then die() { - case $1 in - # FALSE - 1) printf "FATAL: %s\n" "$2" 1>&2 ; exit $1 ;; - # Custom - *) (printf "FATAL: Syntax error $([ -n "${FUNCNAME[0]}" ] && printf "in ${FUNCNAME[0]}")\n%s\n" "$2" 1>&2 ; exit "$1") || (printf "FATAL: %s\n" "$1" 1>&2 ; exit $1) - esac -} fi - # Bail out early if non-interactive -[[ $- != *i* ]] && die 1 "Shell is not interactive" +case $- in + *i*) ;; + *) return;; +esac # Check for updates on initial load... -if ! ((DISABLE_AUTO_UPDATE)) ; then +if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then env OSH=$OSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT bash -f $OSH/tools/check_for_upgrade.sh fi @@ -94,7 +84,7 @@ for alias in ${aliases[@]}; do done # Figure out the SHORT hostname -if [[ $(uname) == Darwin* ]]; then +if [[ "$OSTYPE" = darwin* ]]; then # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible. SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} else @@ -149,7 +139,7 @@ if [ "$OSH_THEME" = "random" ]; then source "$RANDOM_THEME" echo "[oh-my-bash] Random theme '$RANDOM_THEME' loaded..." else - if [ -n "$OSH_THEME" ]; then + if [ ! "$OSH_THEME" = "" ]; then if [ -f "$OSH_CUSTOM/$OSH_THEME/$OSH_THEME.theme.sh" ]; then source "$OSH_CUSTOM/$OSH_THEME/$OSH_THEME.theme.sh" elif [ -f "$OSH_CUSTOM/themes/$OSH_THEME/$OSH_THEME.theme.sh" ]; then