-
Couldn't load subscription status.
- Fork 9
Description
Regarding Bash, I have configurations in /etc/bash.bashrc that I used as pre-configs before ~/.bashrc for regular users as well as configs for root user (interactively). Now when I enter in Bash non-login interactively with some user account, this file gets sourced first before xsh. In there, there's also these lines that came with the distro (Arch):
[[ $- != *i* ]] && return
[[ $DISPLAY ]] && shopt -s checkwinsize
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
My question is, how could I organize this with xsh? I'm looking for a fresh start with separate configs for root and regular users. Should I just delete this file and put everything in the @interactive.bash runcom or would it cause problems? Should I instead make a xsh directory for root user and just copy this file to its interactive runcom?
Same question goes with the /etc/profile file which came with more complicated code, including the umask and functions accessible to /etc/profile.d:
# Set our umask
umask 022
# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
}
# Append our default paths
append_path '/usr/local/sbin'
append_path '/usr/local/bin'
append_path '/usr/bin'
# Force PATH to be environment
export PATH
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi
# Unload our profile API functions
unset -f append_path
# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
test "$PS1" &&\
test -z "$POSIXLY_CORRECT" &&\
test "${0#-}" != sh &&\
test -r /etc/bash.bashrc
then
. /etc/bash.bashrc
fi
# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH
I'm unsure if moving this or the /etc/bash.bashrc will break things, but if possible I'd rather have this in @login runcoms for separate users, would it be possible to delete it and just copy its contents? Should I just copy it without deleting, or maybe a hardlink or maybe don't do anything and make changes only to the ~/.bash_profile @login runcom? I'm looking for advices on how to deal with these /etc/ configs, for Bash and the /etc/zshenv, /etc/zsh/profile configs.