LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 09-18-2007, 09:31 AM   #1
vieraci
Member
 
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45

Rep: Reputation: 15
Question 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.
 
Old 09-18-2007, 10:01 AM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Have you tried putting it in your .bash_profile?

PATH=$PATH:Qt...
export PATH

and then source it.
 
Old 09-18-2007, 10:04 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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
 
Old 09-18-2007, 10:24 AM   #4
vieraci
Member
 
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45

Original Poster
Rep: Reputation: 15
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
 
Old 09-18-2007, 12:01 PM   #5
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
PS1 is the prompt.

meant bash_profile in your home directory, by the way.
 
Old 09-18-2007, 12:05 PM   #6
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
.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.
 
Old 09-19-2007, 01:15 AM   #7
vieraci
Member
 
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45

Original Poster
Rep: Reputation: 15
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.
 
Old 09-19-2007, 01:36 AM   #8
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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.
 
Old 09-19-2007, 03:10 AM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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!
 
Old 09-19-2007, 07:44 AM   #10
vieraci
Member
 
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bigrigdriver View Post
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH variable suavecu Linux - Software 11 01-28-2006 12:44 AM
PATH variable jk21 Linux - Newbie 1 09-28-2004 02:48 PM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM
why is my PATH variable screwed up? apberzerk Linux - General 2 11-07-2003 11:18 PM
the path variable mjkramer Linux - Newbie 4 10-18-2003 07:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration