From: Kenny McCormack on
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...

From: Dave Gibson on
Kenny McCormack <gazelle(a)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).