Why is the value of $PATH in console mode different from the $PATH in xterm emulator?
When in console mode (x-window-system is not loaded),
root@myserver:~#echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 However, when I'm in the window manager (fluxbox) and I open a xterm window, my $PATH has a different value. root@myserver:~#echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ sbin:/bin:/usr/bin/X11 The difference is the additional space between the slash (/) and sbin. That causes /sbin to be missing from my PATH. So any attempt to install package will give the error dpkg: ldconfig not found on PATH dpkg: start-stop-daemon not found on PATH What is causing the additional space between the slash (/) and sbin in the PATH only when in xterm emulator? Any advice would be greatly appreciated. Thanks. PS. Happens on both machines I installed x-window-system, fluxbox, xterm. |
When you login the console /etc/profile is read. Opening an xterm only reads /etc/bash.bashrc, ~/.bashrc.
|
For testing purpose, I installed rxvt and eterm. rxvt has the same error but eterm displays the correct $PATH value ( no extra space ).
In short, $PATH shows the correct value in eterm, but incorrect in rxvt and xterm on both machines. Thanks ! |
Quote:
source /etc/profile in my ~/.bashrc file. Also, how do the following files work in the sense when and how are they called and by whom? Code:
.bash_profile,.bashrc, .profile, /etc/profile, /etc/bash.bashrc, .xsesson and .xinitrc |
Yes that's pretty annoying all this differences. Standards would help.. (maybe dash follows)
I add this type of line in scripts when I don't know when they're called. Code:
echo "In bashrc" | logger |
The first few describe bash's use of the files, because that's what I'm used to. My apologies to users of other shells...
Code:
.bash_profile read by the bash shell every time you login to the system (ie only in login shells); |
What's the difference between xterm, eterm and rxvt in terms of implementation that might have caused this difference? As far as I can notice, /etc/profile is the only place where my $PATH is defined.
Quote:
|
Use these to track down the problem
grep -r 'PATH=' /root grep -r 'PATH=' /etc |
No file under /root but lots under /etc with 'PATH='. Eyeball check seems to indicate none of the lines in /etc contain '/ sbin'. What is the correct syntax to use to grep PATH="some_path_here:/ sbin:more_path_here" (with a space between / and sbin).
Also, another point to consider is why only eterm is not affected. Thanks for all the replies :) Quote:
|
grep -r '/ sbin' /
|
All times are GMT -5. The time now is 05:08 AM. |