The 'bin' in
PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin
is a directory. Some distros will have a bin/ directory in each users home directory and setup the $PATH variable to include it if it exists. I have a number of short scripts that I have written and this is where I put them.
First, read through the startup scripts section 'info bash' . It explains which files are read when you login, and which files are read when you simply open a new shell.
Second, find out which of these scripts are used on your system, and read through them. Often, one script will test for others and source them if they exist. ( Sourcing a script runs it in the same shell instead of a subshell, so variable changes are retained when it finishes. ).
You may for example have a /etc/profile on your system. On SuSE Linux, the comments near the top explain that you shouldn't touch this file but make additions to /etc/profile.local instead. So somewhere in '/etc/profile is a test for the /etc/profile.local which sources it if it exists.
If you want to make global PATH or alias changes, find out where your system currently sets them, and make your additions in the same place. For example, in Mandrake Linux, there is an 'aliasesrc' script that is sourced. Editing this file will change the aliases for all users.
___
Backing up a bit, I should explain why adding '.' to the PATH variable is not a good idea. Suppose you are in a directory that has world write permissions, and another user or a hacker had added a program called 'ls' which will wipe out your home directory. You don't know this and enter 'ls' to get a listing of the files in the directory. If you have '.' in the source path, then the 'ls' script in the current directory will run instead.
There are actually two lessons here. First, don't have '.' in your path. Second, world writable directories should be on partitions mounted with the 'noexec' and 'nodev' options. This is one reason why a server style setup will have a number of partitions, so that they can be mounted with different options to maximize security.
Last edited by jschiwal; 01-28-2005 at 07:13 PM.
|