Import profile from bashrc if profile has not been loaded
On Debian 11, opening a terminal with bash will run a bashrc file without the profile. The bashrc expects profile to be loaded, so it will load the profile. To avoid circular imports, .profile will set __PROFILE_LOADED__ and the bashrc file will load the .profile if that variable has not been set. After that check, bashrc will unset __PROFILE_LOADED__ as cleanup
This commit is contained in:
parent
944dcd7d4b
commit
e1c6ea711a
@ -2,6 +2,12 @@
|
|||||||
# If not running interactively, don't do anything
|
# If not running interactively, don't do anything
|
||||||
[ -z "$PS1" ] && return
|
[ -z "$PS1" ] && return
|
||||||
|
|
||||||
|
if [[ ! $__PROFILE_LOADED__ ]]; then
|
||||||
|
. "${HOME}/.profile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset __PROFILE_LOADED__
|
||||||
|
|
||||||
if [[ -f "${XDG_CONFIG_HOME}/bash/prompt.sh" ]]; then
|
if [[ -f "${XDG_CONFIG_HOME}/bash/prompt.sh" ]]; then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${XDG_CONFIG_HOME}/bash/prompt.sh"
|
source "${XDG_CONFIG_HOME}/bash/prompt.sh"
|
||||||
|
|||||||
@ -51,6 +51,8 @@ fi
|
|||||||
|
|
||||||
unset env_file
|
unset env_file
|
||||||
|
|
||||||
|
export __PROFILE_LOADED__=true
|
||||||
|
|
||||||
if [ -d "${XDG_CONFIG_HOME}/profile/profile.d" ]; then
|
if [ -d "${XDG_CONFIG_HOME}/profile/profile.d" ]; then
|
||||||
for file in "${XDG_CONFIG_HOME}"/profile/profile.d/*.sh; do
|
for file in "${XDG_CONFIG_HOME}"/profile/profile.d/*.sh; do
|
||||||
if [ -r "$file" ]; then
|
if [ -r "$file" ]; then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user