Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
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.
|
 |
09-18-2007, 09:31 AM
|
#1
|
Member
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45
Rep:
|
PATH variable not responding
I'm trying to add my Qt4.3 directory to my PATH, but I'm getting wierd results. I tried setting the two files:
Edited /etc/profile to:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/Qt4.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH=/usr/local/Qt4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
fi
Didn't work, so I also changed /etc/login.defs:
ENV_SUPATH PATH=/usr/local/Qt4.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
ENV_PATH PATH=/usr/local/Qt4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
I logged out and back in again, but the path variable from a console window is:
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
What's going on here ?
OS is Debian etch.
|
|
|
09-18-2007, 10:01 AM
|
#2
|
LQ Guru
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019
Rep: 
|
Have you tried putting it in your .bash_profile?
PATH=$PATH:Qt...
export PATH
and then source it.
|
|
|
09-18-2007, 10:04 AM
|
#3
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
After making the PATH assignment, you need to export it, like so:
Quote:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/Qt4.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export $PATH
else
PATH=/usr/local/Qt4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
export $PATH
fi
|
|
|
|
09-18-2007, 10:24 AM
|
#4
|
Member
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45
Original Poster
Rep:
|
I don't have a .bash_profile in etc.
There is an export statement at the end of .profile
I didn't include it in my post, but here's the rest of it: (I dunno what "if $PS1" is)
if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
# ?? this didn't take !!
# PATH="/usr/local/Qt4.3/bin:"$PATH
export PATH
umask 022
|
|
|
09-18-2007, 12:01 PM
|
#5
|
LQ Guru
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019
Rep: 
|
PS1 is the prompt.
meant bash_profile in your home directory, by the way.
|
|
|
09-18-2007, 12:05 PM
|
#6
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
.bashrc and .bash_profile are hidden files in the users home directory. /etc would have bash_profile and bashrc (bash.bashrc on some distros).
Quote:
# PATH="/usr/local/Qt4.3/bin:"$PATH
|
This is stated incorrectly. It should be '# PATH=$PATH:/usr/local/Qt4.3/bin'. Then remove the comment tag (#) and the double quotes. For more information on the issue of quotes (single and double) see the bash man pages.
The first version above leaves PATH with just one folder: /usr/local/Qt4.3/bin, assuming the double quotes haven't caused problems.
The second version assigns PATH the current value of PATH plus /usr/local/Qt4.3/bin
Last edited by bigrigdriver; 09-18-2007 at 12:11 PM.
|
|
|
09-19-2007, 01:15 AM
|
#7
|
Member
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45
Original Poster
Rep:
|
Yes I know the hash symbol is a comment, I've altered the file a bit since it didn't work just to see if it made any difference.
I tried with and without quotes, also just to see if it made a difference, but the quotes didn't seem to cause any problem.
This is what my first attempt looked like:
# /etc/.profile
if [ "`id -u`" -eq 0 ]; then
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
else
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
fi
# if ... fi prompt stuff
PATH=/usr/local/Qt4.3/bin:$PATH
export PATH
umask 022
# eof
But the point is when I type echo $PATH on the command line, it looks like:
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
There's no X11 in my profile (!?) which led me to think that the path is being set from another script elsewhere...but where ??
I did a grep on X11, looked in home and /etc directories, only file that contains it is /etc/.login.defs (see my first post) but changing this file sort-of worked, if I was super user, path had Qt in there, but not as normal user...can't figure this out !
Last edited by vieraci; 09-19-2007 at 01:17 AM.
|
|
|
09-19-2007, 01:36 AM
|
#8
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
Then perhaps a different search query is called for in your case. Try find /etc -type f | xargs grep 'PATH' to find all references in /etc for PATH. Then track then down one by one until you find the offending case.
|
|
|
09-19-2007, 03:10 AM
|
#9
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Maybe, the best place to define PATH is an entry in /etc/profile.d directory. Look at the other files there: you can put a similar script named qt4.sh. On my OpenSuse box I installed the Qt development package (headers and libraries) and it put qt3.sh and qt3.csh in /etc/profile.d automatically. If you have installed from source, you may have a look in the directory where you compiled and look if these scripts have been created for you. Cheers!
|
|
|
09-19-2007, 07:44 AM
|
#10
|
Member
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45
Original Poster
Rep:
|
Quote:
Originally Posted by bigrigdriver
Try find /etc -type f | xargs grep 'PATH' to find all references in /etc for PATH.
|
Theres lots of hits, but none of interest.
I tried searching for '/usr/bin/X11:' one hit, /etc/login.defs
|
|
|
All times are GMT -5. The time now is 12:30 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
|
|