Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#4388 - Source /etc/profile
Attached to Project:
Arch Linux
Opened by GCN (gilcn) - Thursday, 06 April 2006, 21:23 GMT
Last edited by Judd Vinet (judd) - Wednesday, 12 April 2006, 18:38 GMT
Opened by GCN (gilcn) - Thursday, 06 April 2006, 21:23 GMT
Last edited by Judd Vinet (judd) - Wednesday, 12 April 2006, 18:38 GMT
|
DetailsIs there any reason why /etc/profile isn't sourced after having created a new account ?
One good thing would be to include something like this in the /etc/skel/.bashrc file : if [ -f /etc/profile ]; then . /etc/profile fi This way, it'll also source home-made scripts putted in /etc/profile.d/ |
This task depends upon
Closed by Aaron Griffin (phrakture)
Thursday, 25 May 2006, 16:09 GMT
Reason for closing: Not a bug
Additional comments about closing: See last comment - misunderstanding of how loginShells work
Thursday, 25 May 2006, 16:09 GMT
Reason for closing: Not a bug
Additional comments about closing: See last comment - misunderstanding of how loginShells work
Since I cannot post comments anymore I use the "request re-open". I just wanted to tell that I have to source /etc/profile on my ~/.bashrc. If I don't do that and I open a Konsole/Xterm/whatever, the /etc/profile* scripts aren't read. Maybe a KDE problem or something else then !
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
The different files look as follow (I just past the interesting parts):
~/.bash_profile:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
~/.bashrc:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
Looking at the end of /etc/bashrc gives:
if ! shopt -q login_shell ; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
fi
The /etc/profile file contains (at the end):
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
My Arch's ~/.bashrc contains:
# Source global definitions
if [ -f /etc/profile ]; then
. /etc/profile
fi
And since I added those few lines, my /etc/profile.d/* scripts are correctly sourced (proxy settings, color bash prompt, aliases, etc...).
Maybe I'm doing something wrong, maybe there's a bug somewhere...
Take, for instance, xterm:
-ls This option indicates that the shell that is started in the xterm window will be a
login shell (i.e., the first character of argv[0] will be a dash, indicating to
the shell that it should read the user's .login or .profile).
Passing "-ls" forces xterm to be a login shell, and will then run bash as "-bash" (part of the definition of a login shell is that the first char is a dash).
This can be done with Xresources and many many other settings.
The operative point is that no *profile* scripts are sourced if the shell is not a login shell. Start xterm with -ls (or xterm*loginShell: true in ~/.Xdefaults or some other setting) and your files will be sourced as expected.
Closing.