View previous topic :: View next topic |
Author |
Message |
Kobe8Rice41 n00b
Joined: 05 Oct 2006 Posts: 27
|
Posted: Mon Nov 06, 2006 7:56 pm Post subject: echo $path |
|
|
How do I edit my path so that I can create commands and just run them using the name of the file rather than the full pathname. At my school all I have to say on the command line is the file name and it executes but on my home linux it doesn't work like that. If i say echo $path at school there is a lot of paths, but on mine I say that and there is nothing in my path.
Thanks |
|
Back to top |
|
|
Sachankara l33t
Joined: 11 Jun 2004 Posts: 696 Location: Stockholm, Sweden
|
Posted: Mon Nov 06, 2006 8:00 pm Post subject: Re: echo $path |
|
|
$PATH not $path ... _________________ Gentoo Hardened Linux 2.6.21 + svorak (Swedish dvorak) |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Mon Nov 06, 2006 8:02 pm Post subject: Re: echo $path |
|
|
Kobe8Rice41 wrote: | How do I edit my path so that I can create commands and just run them using the name of the file rather than the full pathname. At my school all I have to say on the command line is the file name and it executes but on my home linux it doesn't work like that. If i say echo $path at school there is a lot of paths, but on mine I say that and there is nothing in my path.
Thanks |
Add ./ to your path - that'll execute anything if it's in the directory you're currently in (anywhere). |
|
Back to top |
|
|
keyson l33t
Joined: 10 Jun 2003 Posts: 830 Location: Sweden
|
Posted: Mon Nov 06, 2006 8:03 pm Post subject: |
|
|
Hi.
There is a big difference between $path and $PATH.
Try
If you want to run a command in the current directory do like this.
Or you may set . in the path in your .bashrc
Code: | export PATH=$PATH:. |
But that may give you trouble if you have a command in the current dir with the
same name as a program you want to run. |
|
Back to top |
|
|
Kobe8Rice41 n00b
Joined: 05 Oct 2006 Posts: 27
|
Posted: Mon Nov 06, 2006 8:11 pm Post subject: |
|
|
How do I add a directory to path? |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Mon Nov 06, 2006 8:21 pm Post subject: |
|
|
One way is to edit your /etc/profile where it says:
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
else
PATH="/usr/local/bin:/usr/bin:/bin:/./:/cxofficebeta/bin:${PATH}"
fi
export PATH
unset ROOTPATH
I made the relevant part red so you can see how you'd add that. |
|
Back to top |
|
|
|