Help with this script

Ed Ravin eravin at panix.uucp
Thu Apr 11 01:49:27 AEST 1991


If you've got ksh to play with, check out the CDPATH variable.  This
will let you select a list of directories to search when you say "cd foo".

For example:

$ CDPATH=".:/usr/mom:/usr/dad:/home"

and then 

$ cd foo

Will search, in order, for ./foo, /usr/mom/foo, /usr/dad/foo, /home/foo
and whichever one it finds first it will cd to (and echo the directory
name it chose).

ksh also gives you built in pattern substitution on the cd command.  So
if your current directory is

/usr/mom/foo/bar/rastafarian/lefthanded/mugglethworp

And you say:

$ cd rastafarian unitarian

ksh will attempt to cd to:

/usr/mom/foo/bar/unitarian/lefthanded/mugglethworp

With all those features, if you can switch to ksh (or are already
using it), you might not want to even bother with "ncd" emulation.
-- 
Ed Ravin            | This random number tells the computer that you are 
cmcl2!panix!eravin  | a member in good standing.  It is not related to your
philabs!trintex!elr | membership number.   --- Sierra Club



More information about the Comp.unix.shell mailing list