2020-11-13 10:25:04 -08:00
|
|
|
#!/bin/bash
|
2021-03-09 13:13:23 -08:00
|
|
|
# non-interactive shell
|
2020-11-18 15:32:09 -08:00
|
|
|
|
2021-03-09 13:13:23 -08:00
|
|
|
([ -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.
|
2021-12-29 21:09:36 -08:00
|
|
|
# echo ---- sourcing system wide bash.bashrc ---
|
2021-03-09 13:13:23 -08:00
|
|
|
# [[ $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
|
2021-12-29 21:09:36 -08:00
|
|
|
# loading just the module functions which will give access to load any module in shell dirs
|
|
|
|
# _BASH_SHELL_BASE_ is/was replaced by the deploy script with actual path
|
2023-12-20 17:21:48 -08:00
|
|
|
source _BASH_SHELL_BASE_/module.base
|
2021-03-09 13:13:23 -08:00
|
|
|
fi
|