PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > PATH puzzle
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

PATH puzzle

Réponse
 
LinkBack Outils de la discussion
Vieux 31/12/2007, 06h32   #1
John W. Krahn
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut PATH puzzle

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
  Réponse avec citation
Vieux 31/12/2007, 07h28   #2
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PATH puzzle

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?
  Réponse avec citation
Vieux 01/01/2008, 03h07   #3
John W. Krahn
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PATH puzzle

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
  Réponse avec citation
Vieux 01/01/2008, 19h05   #4
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PATH puzzle

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.
  Réponse avec citation
Vieux 01/01/2008, 21h36   #5
John W. Krahn
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PATH puzzle

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h06.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,18569 seconds with 13 queries