LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   user path (http://www.linuxquestions.org/questions/slackware-14/user-path-4175433603/)

fatalerror0x00 10-22-2012 10:41 PM

user path
 
What's with the period at the end of my path? Do i if i ever change my path type that in manually or is it automatically put there? Thank you

acummings 10-22-2012 11:13 PM

The period means that

whatever your current working directory happens to be,

said directory *is* in your search path or $PATH

pwd

is the command that lists whatever directory you are currently in which also is known as your "current working directory".

All of this means that if you type and enter the name of an executable file then the system will look for said executable in *all* of the folders in the search path.

The sys also searches in order from beginning to end of the folders that are in the search path.

I forget where $PATH is set, maybe set in /etc/profile

You can add folder onto your $PATH by doing so in your .bashrc file.

--
Alan.

acummings 10-23-2012 12:36 AM

Code:

al@P5Q:~$ $PATH
bash: /usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/java/bin:/usr/lib64/kde4/libexec:/opt/kde3/lib64/qt3/bin:/opt/kde3/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin:.:/home/al/bin:

Also, next is a line that I added into my .bashrc file -- this line adds /home/al/bin onto the end of my $PATH (as can be seen in the above).

Code:

export PATH=$PATH:/home/al/bin
That added folder at the end of my path holds my personal executable files, things such as Perl scripts and executable bash scripts.

--
Alan.

David the H. 10-23-2012 12:02 PM

Remember, "." and ".." are directory names too. The first one is a hardlink to the current directory, and the second is a hardlink to the parent directory. These are built into the filesystem and are not shell aliases or anything like that.

Your PATH variable simply has the "." directory set in it. If you remove it the only thing that will happen is that you won't be able to automatically run executables from the directory you're sitting in. You'd have to prefix the command with an explicit directory path; e.g. "./execname"

GazL 10-23-2012 12:08 PM

Quote:

Originally Posted by David the H. (Post 4813195)
If you remove it the only thing that will happen is that you won't be able to automatically run executables from the directory you're sitting in. You'd have to prefix the command with an explicit directory path; e.g. "./execname"

And some, myself included, would consider that to be a good thing.

Removing the current directory from the PATH is part of my standard post-install routine.

astrogeek 10-23-2012 02:59 PM

Quote:

Originally Posted by GazL (Post 4813200)
Removing the current directory from the PATH is part of my standard post-install routine.

I second that!

fatalerror0x00 10-23-2012 04:55 PM

Weird :P
 
Wow I've never heard of anyone doing that (remvoing it from there path) But I guess it can teach you to not depend up making sure your in the right directory to run commands so i guess it can prove very useful


All times are GMT -5. The time now is 07:11 PM.