Question about CDPATH in bash...

  • Follow


I was having problems with CDPATH, until I worked out (on my own, then
confirmed in the man page) that in order for things to work normally,
you have to have "." in your CDPATH.  For example: export CDPATH=.:$HOME

Otherwise, normal "cd" commands in scripts (e.g., cd foo) don't work.

Now, two comments:
    1) I think this behavior is absurd.  Note that csh/tcsh, which
	invented the "cdpath" concept, doesn't work this way.
    2) It only fails in scripts; interactive "cd" commands (or, equivalently,
	"cd" commands in "dotted" [sourced] scripts) work fine.

The first is obviously a religious issue, but the second one I find
really weird.

-- 
Just for a change of pace, this sig is *not* an obscure reference to
comp.lang.c...

0
Reply gazelle 6/14/2010 12:14:55 AM

Kenny McCormack <gazelle@shell.xmission.com> wrote:
> I was having problems with CDPATH, until I worked out (on my own, then
> confirmed in the man page) that in order for things to work normally,
> you have to have "." in your CDPATH.  For example: export CDPATH=.:$HOME
> 
> Otherwise, normal "cd" commands in scripts (e.g., cd foo) don't work.
> 
> Now, two comments:
>    1) I think this behavior is absurd.  Note that csh/tcsh, which
>        invented the "cdpath" concept, doesn't work this way.
>    2) It only fails in scripts; interactive "cd" commands (or, equivalently,
>        "cd" commands in "dotted" [sourced] scripts) work fine.
> 
> The first is obviously a religious issue, but the second one I find
> really weird.

Sounds like a difference in invocation -- bash (working) vs. sh (failing).
0
Reply dave 6/14/2010 10:23:34 AM


1 Replies
257 Views

(page loaded in 0.232 seconds)

Similiar Articles:





7/11/2012 8:41:01 AM


Reply: