PATH puzzle
am 31.12.2007 07:32:01 von someone
I was recently doing something and noticed that /home/john/bin was
included in my PATH twice. I did a recursive search through /etc and
/home/john and the only place I could find where /home/john/bin was
added to the PATH was in /home/john/.profile. If I comment out the
modification in /home/john/.profile then I still get /home/john/bin in
PATH. Note that this only effects users and not root. OS is Kubuntu
7.10 and shell is GNU bash, version 3.2.25(1)-release-(i486-pc-linux-gnu).
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
Re: PATH puzzle
am 31.12.2007 08:28:40 von Icarus Sparry
On Mon, 31 Dec 2007 06:32:01 +0000, John W. Krahn wrote:
> I was recently doing something and noticed that /home/john/bin was
> included in my PATH twice. I did a recursive search through /etc and
> /home/john and the only place I could find where /home/john/bin was
> added to the PATH was in /home/john/.profile. If I comment out the
> modification in /home/john/.profile then I still get /home/john/bin in
> PATH. Note that this only effects users and not root. OS is Kubuntu
> 7.10 and shell is GNU bash, version
> 3.2.25(1)-release-(i486-pc-linux-gnu).
>
>
> John
Hard to tell from this information!
Is this a console login, or are you running X windows?
If you use "ssh localhost" do you still have the same issue?
Does your home/john/.profile append /home/john/bin to your PATH or does
it set the PATH to a fixed value?
Have you looked for $HOME/bin and ~/bin as well as /home/john/bin?
Have you tried adding some lines like
set -x
echo "At start of .profile" $PATH
to the start of the .profile, and
echo "At end of .profile" $PATH
set +x
to the end? If so is /home/john/bin in the PATH at the start of .profile?
How many times do you see the .profile being executed?
Re: PATH puzzle
am 01.01.2008 04:07:06 von someone
Icarus Sparry wrote:
> On Mon, 31 Dec 2007 06:32:01 +0000, John W. Krahn wrote:
>
>> I was recently doing something and noticed that /home/john/bin was
>> included in my PATH twice. I did a recursive search through /etc and
>> /home/john and the only place I could find where /home/john/bin was
>> added to the PATH was in /home/john/.profile. If I comment out the
>> modification in /home/john/.profile then I still get /home/john/bin in
>> PATH. Note that this only effects users and not root. OS is Kubuntu
>> 7.10 and shell is GNU bash, version
>> 3.2.25(1)-release-(i486-pc-linux-gnu).
>
> Hard to tell from this information!
>
> Is this a console login, or are you running X windows?
No problems on a console login, just, it seems, on xterm.
> If you use "ssh localhost" do you still have the same issue?
> Does your home/john/.profile append /home/john/bin to your PATH or does
> it set the PATH to a fixed value?
This is what is in /home/john/.profile which, it appears, was copied
from /etc/skel/.profile when the account was created.
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
> Have you looked for $HOME/bin and ~/bin as well as /home/john/bin?
I did a search for 'PATH'.
> Have you tried adding some lines like
> set -x
> echo "At start of .profile" $PATH
> to the start of the .profile, and
> echo "At end of .profile" $PATH
> set +x
> to the end? If so is /home/john/bin in the PATH at the start of .profile?
> How many times do you see the .profile being executed?
I tried that and there are too many lines generated to see what is
happening at the beginning.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
Re: PATH puzzle
am 01.01.2008 20:05:19 von Icarus Sparry
On Tue, 01 Jan 2008 03:07:06 +0000, John W. Krahn wrote:
> Icarus Sparry wrote:
>> On Mon, 31 Dec 2007 06:32:01 +0000, John W. Krahn wrote:
>>
>>> I was recently doing something and noticed that /home/john/bin was
>>> included in my PATH twice. I did a recursive search through /etc and
>>> /home/john and the only place I could find where /home/john/bin was
>>> added to the PATH was in /home/john/.profile. If I comment out the
>>> modification in /home/john/.profile then I still get /home/john/bin in
>>> PATH. Note that this only effects users and not root. OS is Kubuntu
>>> 7.10 and shell is GNU bash, version
>>> 3.2.25(1)-release-(i486-pc-linux-gnu).
>>
>> Hard to tell from this information!
>>
>> Is this a console login, or are you running X windows?
>
> No problems on a console login, just, it seems, on xterm.
OK, this is an important clue.
How do you start X? There are two typical ways it can be done. One is to
have the system start X, and you log into it, typically using a display
manager (xdm, kdm etc). The other way is you log in to a console, and
then run some command such as "startx".
The other factor to consider what kind of "xterm" you are running, and if
the xterm is set up to be a "login shell" window (specified with a '-ls'
or options in the X resource database).
I think what is happening is that you have ".profile" being executed
twice, once before the xterm is started and then a second time by the
bash that is being run inside the xterm.
Re: PATH puzzle
am 01.01.2008 22:36:07 von someone
Icarus Sparry wrote:
> On Tue, 01 Jan 2008 03:07:06 +0000, John W. Krahn wrote:
>
>> Icarus Sparry wrote:
>>>
>>> Is this a console login, or are you running X windows?
>> No problems on a console login, just, it seems, on xterm.
>
> OK, this is an important clue.
>
> How do you start X? There are two typical ways it can be done. One is to
> have the system start X, and you log into it, typically using a display
> manager (xdm, kdm etc). The other way is you log in to a console, and
> then run some command such as "startx".
>
> The other factor to consider what kind of "xterm" you are running, and if
> the xterm is set up to be a "login shell" window (specified with a '-ls'
> or options in the X resource database).
OK, that was it! I removed the -ls switch and all is well. Thanks.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall