[NTLUG:Discuss] Is this the way it's supposed to work?
Chris Cox
cjcox at acm.org
Wed Apr 29 10:14:03 CDT 2009
On Wed, 2009-04-29 at 02:01 -0500, Leroy Tennison wrote:
> (BTW, I'm running SuSE 10.3.) Given a directory with the following
> subdirectories (others removed for brevity):
>
> Desktop
> Documents
>
> Doing
>
> cd De*
Evaluates do Desktop if the above are the only directories
at the current level.
>
> puts me in the Desktop subdirectory. At this point doing
>
> cd ../Do*
The .. means parent directory of the current, then
Do* evaluates (matches) Documents.
>
> puts me in the Documents directory. Next, doing
>
> cd D*
Nope... assuming you're in the Documents directory,
you'd need to do cd ../D* ... UNLESS
you have CDPATH setup (echo $CDPATH). Then, similar
to PATH, the CDPATH is searched when relative (non fully
qualified) change directory requests are given. Since
cd D* isn't fully qualified, it looks local first then
it would peruse your CDPATH if set and see if it
can find a match. You need to be careful with things
like CDPATH since it can take you to contexts that
are very outside what you're doing (resulting sometimes
in unexpected/sad results).
>
> puts me in the Desktop subdirectory.
>
> I first discovered this by accident in DOS under Windows then thought
> "Is it the same under Linux?" I think the 'cd D*' returns an error
> under Windows, don't have a installed copy at home so I can't test.
>
>
> From my DOS programming days (yes, I'm THAT old!) I remember findfirst
> and findnext and thus understand what's probably going on behind the
> scenes. I'm just surprised that this kind of fuzziness exists in the
> UI. Bug or feature (or both)?
More information about the Discuss
mailing list