Click to See Complete Forum and Search --> : Setting Path Enviornment to Run Scripts


Usulsuspct
05-05-2001, 03:49 PM
I am trying to set my csh path enviornment variable upon launch of the shell to inlude a directory I have made that contains scripts I want to be able to run without having to explicitly name thier paths.

I am using mandrake 7.2, and I have tried editing the /etc/csh.login file, but I still havent been able to use the directory I created.

I made a directory /usr/scripts that has some scripts I have written, and I dont want to have to type /usr/scripts/scriptname everytime I want to execute them.

What do you say? I would like it to happen upon login automatically rather than have to say setenv or what have you.

bdl
05-05-2001, 05:54 PM
You should be able to do this with a .profile file in your home directory. Just add the following and you should be good to go:

## ~/.profile
## example
## change for your system

umask 022

PATH="$PATH:$HOME/bin:/usr/scripts:/path/to/other/bin"

## eof

Thats about it. If you want to specify all paths in your .profile, just leave off the $PATH directive and list every path you will need to access by hand. Just dont forget to leave out "." (pwd), it's a security risk. Also, please realize that if you have different versions of or different scripts altogether with the same name, whichever is in your path first will be the one issued; this is a common method of allowing trojans to run on your system, they just stick 'em closer in your PATH (usually ".") and so you execute the trojaned script/app first rather than the one you intend to.

Linuxcool
05-05-2001, 05:59 PM
Maybe you have to edit the user's csh profile instead of the csh.login. Look in the user's directory to see if there is a file that has ' csh ' in it.

Coral Sea
05-05-2001, 06:05 PM
In the user's home directory (and in /root too if he uses csh), you should find a file called .cshrc (it will likely be a hidden file so ls -a to find it). Then add a line to that file. I think csh uses "set path = " instead of the more familiar (to me anyway) "PATH = ."