Load shrc files if the shell is interactive

This commit is contained in:
Anthony Rose 2022-08-23 13:13:40 +01:00
parent 3b6f524a3a
commit a94cc10f72
5 changed files with 49 additions and 10 deletions

View file

@ -6,7 +6,14 @@ fi
export BASH_ENV="$HOME/.bashrc" export BASH_ENV="$HOME/.bashrc"
export _acp_ignore_shrc=1
if [ -r "$HOME/.profile" ] if [ -r "$HOME/.profile" ]
then then
. "$HOME/.profile" . "$HOME/.profile"
fi fi
unset _acp_ignore_shrc
if [ -r "$HOME/.bashrc" ]
then
. "$HOME/.bashrc"
fi

View file

@ -1,4 +1,13 @@
#!/bin/bash #!/bin/bash
case "$-" in
*i*)
;;
*)
# Shell is not interactive.
return 1
;;
esac
if [ -f /etc/bashrc ] if [ -f /etc/bashrc ]
then then
. /etc/bashrc . /etc/bashrc

View file

@ -1,4 +1,18 @@
#!/bin/sh #!/bin/sh
if [ -n "$_acp_ignore_shrc" ]
then
return 1
fi
case "$-" in
*i*)
;;
*)
# Shell is not interactive.
return 1
;;
esac
if [ -d /var/acp ] if [ -d /var/acp ]
then then
export ACP=/var/acp export ACP=/var/acp
@ -294,11 +308,4 @@ tlscheck () {
fi fi
} }
case "$-" in usermotd
*i*)
# Shell is interactive
usermotd
;;
*)
;;
esac

View file

@ -4,7 +4,14 @@ then
. /etc/zprofile . /etc/zprofile
fi fi
if [ -e $HOME/.profile ] export _acp_ignore_shrc=1
if [ -r "$HOME/.profile" ]
then then
emulate sh -c ". $HOME/.profile" emulate sh -c '. "$HOME/.profile"'
fi
unset _acp_ignore_shrc
if [ -r "$HOME/.zshrc" ]
then
. "$HOME/.zshrc"
fi fi

View file

@ -1,4 +1,13 @@
#!/bin/zsh #!/bin/zsh
case "$-" in
*i*)
;;
*)
# Shell is not interactive.
return 1
;;
esac
if [ -f /etc/zshrc ] if [ -f /etc/zshrc ]
then then
. /etc/zshrc . /etc/zshrc