From 22d06452fbfbdd0a0deb8dfa7c3ca1645b847083 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 3 Jan 2017 15:21:04 +1300 Subject: Short-circuit in rbash before even loading ENV --- bash/bashrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bash/bashrc b/bash/bashrc index 088182ef..4ca8b176 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -4,6 +4,10 @@ case $- in *) return ;; esac +# Don't do anything if restricted, not even sourcing the ENV file +# Testing $- for "r" doesn't work +[ -n "$BASH_VERSINFO" ] && shopt -q restricted_shell && return + # If ENV is set, source it to get all the POSIX-compatible interactive stuff; # we should be able to do this even if we're running a truly ancient Bash [ -n "$ENV" ] && . "$ENV" @@ -17,9 +21,6 @@ esac ((10#${BASH_VERSINFO[1]%%[!0-9]*} < 5)) && return -# Don't do anything if running a restricted shell -shopt -q restricted_shell && return - # Keep around 32K lines of history in file HISTFILESIZE=$((1 << 15)) -- cgit v1.2.3