Skip to content

Commit

Permalink
main: suppress non-interactive session warnings also for ".bash_profile"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jul 28, 2022
1 parent f41b800 commit 2587bb0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ble.pp
Expand Up @@ -49,11 +49,6 @@
return 1 2>/dev/null || exit 1
fi

if [ -n "${-##*i*}" ]; then
echo "ble.sh: This is not an interactive session." >&2
return 1 2>/dev/null || exit 1
fi

_ble_bash=$((BASH_VERSINFO[0]*10000+BASH_VERSINFO[1]*100+BASH_VERSINFO[2]))

if [ "$_ble_bash" -lt 30000 ]; then
Expand All @@ -71,6 +66,12 @@
" We recommend using ble.sh with a release version of Bash." >&2 ;;
esac

if [[ $- != *i* ]]; then
{ ((${#BASH_SOURCE[@]})) && case ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} in (*bashrc|*bash_profile) ;; (*) false ;; esac } ||
echo "ble.sh: This is not an interactive session." >&2
return 1 2>/dev/null || exit 1
fi

if ((BASH_SUBSHELL)); then
builtin echo "ble.sh: ble.sh cannot be loaded into a subshell." >&2
return 1 2>/dev/null || builtin exit 1
Expand Down

0 comments on commit 2587bb0

Please sign in to comment.