1847860 Members
4084 Online
104021 Solutions
New Discussion

exporting PATH

 
Kurtkarl
Frequent Advisor

exporting PATH

HI,

I created a script and put it on my local dir then include it on my existing PATH using the command "export PATH=$PATH:/users/jdean/test.sh"

When I run echo $PATH I could see already my new dir included. Now my question is, why is it whenever I run "whereis test.sh" from the command line from any dir, system could not find my script to think it's already included in my PATH?

Also I noticed that, when I copied files or scripts to our /usr/local/bin dir which I added also on my existing PATH the "whereis" command can locate these files or script from any dir I'm in.

Any Ideas? Did I miss something here?

Thanks in advance
Joey
Just starting to learn thru this forum
6 REPLIES 6
Eileen Millen
Trusted Contributor

Re: exporting PATH

We only have the directory path in our PATH statements, not script or file names.
Maureen Gunkel
Trusted Contributor

Re: exporting PATH

Joey,
You need to change your path statement to:
export PATH=$PATH:/users/jdean
Don't include the file name, just the path to the filename.
Mo
No matter where you go, there you are.
Kurtkarl
Frequent Advisor

Re: exporting PATH

Guys,
Sorry I did'nt mean to include the file or the script when exporting path "typo error". Actually I exported this dir without the file or script just the dir but it didnt work.

Any ideas?
Thanks
Joey
Just starting to learn thru this forum
James R. Ferguson
Acclaimed Contributor

Re: exporting PATH

Hi Joey:

The man pages for 'whereis' note that whereis ..."attempts to locate the desired program in a list of standard places". This is the reason you are not getting a 'hit'.

You can execute 'whereis' for a non-standard directory (or directories) like this, for instance:

# whereis -B /tmp /var/tmp -f ls

This would look in /tmp and in /var/tmp for the 'ls' executable.

...JRF...
Bill Hassell
Honored Contributor

Re: exporting PATH

The command you are looking for is not whereis but whence. whereis (and which) do not really show you what the shell will do when you type a simple command name.

whence -v ksh

or

whence -v history

will tell you exactly what will occur, whether the command is a builtin (like fc), an alias (like history) or found some where along the $PATH list. Always use whence to test for 'where did this command come from?'


Bill Hassell, sysadmin
Dan Hetzel
Honored Contributor

Re: exporting PATH

Hi Joey,

If you use 'which test.sh' it surely will show you the path to the file.

see 'which' manpage.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com