1838580 Members
3105 Online
110128 Solutions
New Discussion

PATH

 
navin
Super Advisor

PATH

Hello All,
I have a script script.sh in a directory /usr/master1/pat
I have to give full path name as below to get the script running. i need to make it as just the script name .Any idea.
#/usr/master/pat/script1.sh
works
#pwd
#/usr/master/pat
script.sh
does not work

i need to update PATH to PATH:. but the problem is not sure which env file is thi susing cause .profile , profile has . in the PATH definition
Learning ...
4 REPLIES 4
Paul Sperry
Honored Contributor

Re: PATH

If your in /usr/master/pat you need to execute the script as following.

#./script.sh

you can set the PATH this way

#export PATH=$PATH:/usr/master/pat

you can also but that line in your .profile
Steven Schweda
Honored Contributor

Re: PATH

> [...] not sure [...]

"echo $PATH" to see what you have.

> [...] profile has . in the PATH definition

Which "[.]profile"? Whose "[.]profile"?

This might be easier to puzzle out if anyone
other than you could see what's in your PATH
and/or .profile. And if we knew which shell
you use.
Steven Schweda
Honored Contributor

Re: PATH

Or perhaps you could put the keyword PSYCHIC
in your subject, so we non-psychics could
save some time and effort.
James R. Ferguson
Acclaimed Contributor

Re: PATH

Hi:

The "#" prompt suggests that you are running the script as root.

Learn to do:

# ./script.sh

Do *NOT* add '.' to root's PATH. It is a security hole. In fact, this is documented in 'root's '.profile' (which would be the other part of your question).

A '.profile' is read when you 'su -'. If you simply do 'su' the target user's .profile is *not* read.

Regards!

...JRF...