You are not logged in.
Subject says it all - if I log in as root from a tty rather than switching to root, root's ~/.bashrc doesn't get sourced. What am I missing?
/root/.bashrc
if [ -f /etc/profile ]; then
. /etc/profile
fi
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
alias nets="netstat -nlpt"
alias nets2="lsof -i"
alias ll="ls -lh"
alias rm="rm -i"
alias mv="mv -i"
alias pp="powerpill -Syu"
# Check for an interactive session
[ -z "$PS1" ] && return
alias ls='ls --color=auto'
#PS1='[\u@\h \W]\$ '
PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '
PATH=$PATH:/root/bin
Last edited by graysky (2010-10-05 20:58:49)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Maybe because it's your login shell, so /root/.bash_profile is sourced, rather than /root/.bashrc.
https://bbs.archlinux.org/viewtopic.php … 29#p834929
Last edited by karol (2010-10-04 21:32:27)
Offline
You're missing the INVOCATION section of man bash
It's common to add
. $HOME/bashrc
to your ~/.bash_profile or ~/.profile (whichever you use/choose to create) to source bashrc also for login shells.
Offline
A login shell doesn't run .bashrc but runs the .bash_profile instead (okay it's slightly more to it than that you need to read the INVOCATION section of man bash for he full story). This is normally transparent to most users as a lot of systems have a bare bones .bash_profile and instead call .bashrc from that. You need to check the profile file(s) to see whether it tries to call .bashrc - but I'm guessing it doesn't. It's /etc/profile, then ~/.bash_profile, ~/.bash_login, and ~/.profile.
You could put the code you want into /root/.bash_profile or in /root/.bash_profile call /root/.bashrc. The .profile file is so that the same file can be sourced if using different shells.
There are also two options worth knowing about, --norc and --rcfile which change non-login interactive shell behaviour.
EDIT: waaaaayyyy too slow.
Last edited by skanky (2010-10-04 21:33:11)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
thanks for the replies, all!
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline