This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-base/setup/etc/bash.bashrc

26 lines
942 B
Bash

#!/bin/bash
# non-interactive shell
([ -n "$SSH_CONNECTION" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]) && export SSH_SESSION=true
[[ $- == *i* ]] && export SHELL_INTERACTIVE=true
shopt -q login_shell && export SHELL_LOGIN=true
[ $EUID -eq 0 ] && export USER_ROOT=true
#uncomment these for debugging.
# echo ---- sourcing system wide bash.bashrc ---
# [[ $USER_ROOT ]] && echo 'Root User' || echo 'Non Root User'
# [[ $SHELL_INTERACTIVE ]] && echo 'Interactive' || echo 'Not interactive'
# [[ $SHELL_LOGIN ]] && echo 'Login shell' || echo 'Not login shell'
# [[ $SSH_SESSION ]] && echo ssh remote user || echo local user
# echo ---------------------
if ( [[ $SHELL_INTERACTIVE ]] );then
source /etc/profile
else
# Set the initial path
export PATH=/bin:/usr/bin:/usr/local/bin
# set this for access to any shell sources
export BASH_SHELL_BASE=/opt/bash/shell/base
# loading module functions
source $BASH_SHELL_BASE/module.lib
fi