Paths


As was just mentioned, a path tells the shell where to look for programs that you want to execute. You might notice that if you have a copy of a program in your current directory, typing the filename sometimes results in a command not found error. This is because it's common for the path variable to lack the current directory. A good way to simulate this problem is to type the following:

 > \(- > (-: Command not found 

In addition to getting a nice smiley face you can see that there is no command found for this entry. All this means is that you either don't have a path or you don't have a command. You can execute programs in the current directory by typing ./<program> or by adding the current directory to your path. The current directory is usually left out of the path because including it could be a security risk. Because working with Unix implies knowing a little about security and how to protect Unix, you should be aware of why you may not have a command present if needed, or an option available that you may need or want.

If your current directory is in your path, you can potentially be fooled into executing arbitrary programs by naming them as common Unix commands, and sneaking them into your directories as aliases or script files, which is not good.

If you want to see what your current path is, you can do so by using echo $PATH. If it's missing some paths you need, the current directory and /usr/local/bin, for example, you can add these by using the following command:

 set path=($path /usr/local/bin .) 

Now that you are familiar with working with a path and viewing it, let's take a look at your Unix user defaults and dot files.



    SAMS Teach Yourself Unix in 10 Minutes
    Sams Teach Yourself Unix in 10 Minutes (2nd Edition)
    ISBN: 0672327643
    EAN: 2147483647
    Year: 2005
    Pages: 170

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net