Operating System - Linux
1752805 Members
5481 Online
108789 Solutions
New Discussion юеВ

Re: What is the meaning of :.: in the PATH?

 
SOLVED
Go to solution
Bill Hassell
Honored Contributor

Re: What is the meaning of :.: in the PATH?

And just a couple of alternative forms for :.:
If the last character in $PATH is :, it's the same as :.: and if two adjacent :: are in $PATH, it means :.: (this is a common error caused by editing /etc/PATH or bad install scripts. As mentioned, the current working directory (seen by the pwd command) should always be assumed to be suspect. In fact, some sysadmins learned that the way to run a program is to cd to the directory and then type the command name (leftover from bad DOS habits).

$PATH can be a severe security risk for users, and especially for the root superuser. /etc/PATH establishes a default set of 'safe' paths to look for executazbles but it often turns into a massive list of possibile locations, often due to applicsation installers. root's PATH should be different and more restrictive than user PATH values.

Also, don't use which and whereis to 'locate' programs as they do not follow the rules that a shell uses. Instead, determine where a particular executable will be found by using the whence command, specifically whence -v (which is aliased to: type) This command tells you exactly the path that a specific command has in your current environment. It is not a 'find' command but a "what will happen if" command.


Bill Hassell, sysadmin
Eric Antunes
Honored Contributor

Re: What is the meaning of :.: in the PATH?

Thank you all!

I will let those oracle and applmgr PATH definitions as they are because this is needed to apply application patches, for example.

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Muthukumar_5
Honored Contributor

Re: What is the meaning of :.: in the PATH?

If you are having . in PATH variable then it is including current directory itself.

Then you don't need to execute script as,

# ./scriptname.sh

# scriptname.sh

is enough. You can include a scriptfile with out syntax as,

# . ./scriptname.sh

simply as,

scriptname.sh

in any other script(s). How ever it is not good to add it. Try to remove that . in PATH.

--
Muthu

Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: What is the meaning of :.: in the PATH?

Hi Eric,

Have a look at this doc from CERT,

http://www.cert.org/tech_tips/usc20.html

[UNIX Security Checklist v2.0]

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Vibhor Kumar Agarwal
Esteemed Contributor

Re: What is the meaning of :.: in the PATH?

People generally do this for their convenience.

If you create a script file then you have to run it like

./script_name

But if you have the . in the path simply

script_name will run

Now it depends on you whether you want it or not :-)
Vibhor Kumar Agarwal
Eric Antunes
Honored Contributor

Re: What is the meaning of :.: in the PATH?

Unfortunatly, I must leave this as many Oracle built-in scripts seems to get advantage of this kind of PATH.

Thank you!
Each and every day is a good day to learn.