Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The PATH shell variable is wrong on my system (Mandrake 9.2). I can set it properly with
PATH=/usr/bin:/usr/sbin:...
Where in the system (/etc/ ?) are shell variables set on boot?
Environment variables are set depending on the user and upon which shell they choose to use. If you're using bash for your shell (the default on many Linux distributions), check for a file called .bashrc in your home directory. There's also a global set of definitions in /etc/bashrc. If you want to change your path, for instance, you can edit your ~/.bashrc to add any environment variables you want.
By the way, what's wrong with your path variable? Mine's always given me everything I need; usually, normal users should have /bin, /usr/bin, /usr/local/bin, /usr/X11R6/bin and possibly a couple others. Normal users could, I suppose, have /usr/sbin and /sbin on their path as well, but most of the time they don't need to, since they contain system administration binaries, and only root should be running them most of the time.
I have the same .bashrc for both root and my normal user:
# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
There is nothing in /etc/bashrc for PATH.
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
umask 002
else
umask 022
fi
# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
if [ -z "$loginsh" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -x $i ]; then
. $i
fi
done
fi
fi
unset loginsh
Every time I start a new shell the path is reset to this:
/usr//bin:/bin:/usr/bin::/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/tmoorman/bi
Some PATH stuff is probably set in /etc/profile and/or ~/.profile. It looks like your /etc/bashrc is also pulling in all the scripts from /etc/profile.d/*, which may also be changing the PATH.
If you want your path to be something explicit, you could just add to ~/.profile:
export PATH=/stuff/you/want/on/the/path
but that could disrupt things if you install a new program that also needs to add itself to your path, so it's probably better to use:
I found the solution at mandrakeclub.com http://www.mandrakeclub.com/modules....&post_id=32900
There are two variables, SystemPath and UserPath in /usr/share/config/kdm/kdmrc, which were set incorrectly. I changed them, restarted Kde and now I get the correct path with every shell.
This seems to be specific to Mandrake 9.2 upgrades.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.