From 31f095f3ac7d9a6725b6646c35b131614833067f Mon Sep 17 00:00:00 2001 From: Jacob Hrbek Date: Wed, 24 Jul 2019 03:00:45 +0200 Subject: [PATCH] oh-my-bash: Show warning and fail for non-interactive shells Co-authored-by: Koichi Murase --- oh-my-bash.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/oh-my-bash.sh b/oh-my-bash.sh index 9b5dffb..83cf81a 100644 --- a/oh-my-bash.sh +++ b/oh-my-bash.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Bail out early if non-interactive -case $- in - *i*) ;; - *) return;; -esac +if [[ $- != *i* ]]; then + printf 'oh-my-bash: Shell is not interactive.\n' >&2 + return 1 +fi # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then