PATH ~/bin under gnome
Peter Garrett
peter.garrett at optusnet.com.au
Tue Nov 21 13:03:51 UTC 2006
On Tue, 21 Nov 2006 07:31:18 -0500
"Todd Slater" <dontodd at gmail.com> wrote:
> On 11/21/06, Peter Garrett <peter.garrett at optusnet.com.au> wrote:
> > On Mon, 20 Nov 2006 17:45:40 -0500
> > "Todd Slater" <dontodd at gmail.com> wrote:
> >
> > > On 11/20/06, rodrigochinaski <rodrigo.chinaski at gmail.com> wrote:
> > > > Greetings...
> > > >
> > > > I would like to add my ~/bin in the PATH. I already uncommented the
> > > > following lines on my ~/.bash_profile, but it only works on the console,
> > > > not on the gnome environment.
> > > >
> > > >
> > > > # set PATH so it includes user's private bin if it exists
> > > > if [ -d ~/bin ] ; then
> > > > PATH="${PATH}":~/bin
> > > > fi
> > > >
> > > > What's the "cleanest" way to do this?
> > >
> > > Just add that to the end of your ~/.bashrc file. You'll probably have
> > > to log out and back in for it to take effect.
> >
> > No. Gnome doesn't read ~/.bashrc - it only applies to the console
> > or terminal emulators.
> >
> > I think the file to use would be ~/.gnomerc , which doesn't exist by
> > default, but is executed if present when you log in to GNOME.
> >
> > Edit: Just tried it and it works as I suggested . An Xdialog script in
> > ~/bin "works" with it, and so does ~/bin/mailspeak ;) -
> >
> > #!/bin/bash
> > # "Just for fun"
> > echo " `echo $USER`. you have mail" | festival --tts
>
> I only call items in ~/bin from a terminal so adding it to ~/.bashrc
> works for me. How else do you call those scripts?
Right - ~/.bashrc works when you call stuff from the command line. If, for
example, you want to run a script that has a graphical front end ( using
zenity, Xdialog or kdialog for instance), typing the command for the
script in ~/.bashrc will work fine.
If, on the other hand, you want to use a GNOME menu item or panel launcher
etc. , you would have to type the whole path. ( example: your launcher
would have the command field as /home/peter/timer ) By placing the same
path generating lines in ~/.gnomerc , you ensure that *GNOME* knows ~/bin
is in your PATH. Thus, a launcher or graphical menu item with the command
"timer" ( without quotes ) will then work.
Personally I can't think of a use case where this is particularly
important, but my interpretation was that this would be what the OP
wanted .
Since ~/bin is placed first in the list of directories in the
PATH by that snippet from ~/.bash_profile , I suppose for example, that if
you had two identically named executables, doing this would make sure the
one in your personal directory ran on menu click, instead of the "global
default". That could be handy for people who have no root access but want
to run an updated app installed in ~/bin.
On the other hand, it isn't hard to edit a menu or launcher to include a
full path.
Peter
More information about the ubuntu-users
mailing list