Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
11-19-2003, 10:55 AM
|
#1
|
Member
Registered: Aug 2003
Location: Ottawa, Ontario, Canada
Distribution: Kubuntu
Posts: 50
Rep:
|
Setting Shell variables
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?
Thanks
|
|
|
11-19-2003, 11:00 AM
|
#2
|
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
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.
Last edited by wapcaplet; 11-19-2003 at 11:03 AM.
|
|
|
11-19-2003, 11:19 AM
|
#3
|
Member
Registered: Aug 2003
Location: Ottawa, Ontario, Canada
Distribution: Kubuntu
Posts: 50
Original Poster
Rep:
|
I am running bash
echo $SHELL
/bin/bash
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
Where is this set?
|
|
|
11-19-2003, 11:22 AM
|
#4
|
Member
Registered: Aug 2003
Location: Ottawa, Ontario, Canada
Distribution: Kubuntu
Posts: 50
Original Poster
Rep:
|
BTW, I am running Konsole under Kde 3.1
|
|
|
11-19-2003, 01:34 PM
|
#6
|
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
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:
export PATH=$PATH:/other/stuff
which will just add to your existing path.
|
|
|
11-19-2003, 03:41 PM
|
#7
|
Member
Registered: Aug 2003
Location: Ottawa, Ontario, Canada
Distribution: Kubuntu
Posts: 50
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 02:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|