Reading your $PATH (WAS Re: [plug] Questions for information - Richard)

Russell Steicke r.steicke at bom.gov.au
Sun May 5 14:59:03 WST 2002


On Sun, May 05, 2002 at 02:35:26PM +0800, James Elliott wrote:
...
> The reason the command will not execute even though yu are in the same
> directory is because you do not have that directory in your
> current search path.  If you type:
> 
> echo $PATH
> 
> It will display the directories in your path, separated by colons.  It


Sort of related to this:  On some systems I have PATH vars with around
20 entries.  That becomes really hard to read, so here's something I put
in ~/bin/path

  #!/bin/sh
  echo $PATH |awk -F : '{for (i=1;i<=NF;i++)print $i;}'

Now I type 'path' instead of 'echo $PATH' and it's actually readable.
Being a java programmer, I also have a very similar scriptlet called
classpath.

For the pedants here, yes, this would be better as a shell function.
Put:

  path ()
  {
    echo $PATH | awk -F : '{for (i=1;i<=NF;i++)print $i;}'
  }

in your .bashrc or equivalent (.profile or .kshrc etc).





-- 
Russell Steicke

-- Fortune says:
La-dee-dee, la-dee-dah.



More information about the plug mailing list