Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2001 09:43:50 -0600
From:      Lucas Bergman <lucas@slb.to>
To:        CB <chris@JEAH.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: cd with wildcards (Was: subjectless)
Message-ID:  <20010329094350.A30830@billygoat.slb.to>
In-Reply-To: <1.5.4.32.20010327235125.0066b348@JEAH.net>; from chris@JEAH.net on Tue, Mar 27, 2001 at 05:51:25PM -0600
References:  <1.5.4.32.20010327235125.0066b348@JEAH.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> awww# cd pic*
> pic*: Ambiguous.
> awww#
> 
> In this directory there is "pic22.tgz" and "pic22/"
> 
> You would think that if you type "cd" and there are no other
> directories that match the argument specified, it would simply go to
> the only directory that matches.
> 
> Why doesn't it?

The cd "command" is built-in to whatever shell you're using.  You're
right; there's no reason that I can think of that `cd pic*' above
shouldn't go ahead and do `chdir("pic22")'.  The authors of tcsh (you
are using tcsh, no?) just didn't make it that way.  Maybe they were
emulating old csh behavior, or maybe they just didn't think of it.

FYI, bash does something different; namely, it expands the shell
wildcards and drops all arguments but the first to cd.  So, in your
case above `cd pic22*' does what you expect, but only because pic22
comes before pic22.tgz when the '*' is expanded.

HTH,
Lucas

P.S. Please, put a decent subject line in your mail, as a courtesy to
those of us who answer questions in our spare time.  As a rule,
subjectless mail is evil, but it's more evil when you're scanning
hundreds of messages.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010329094350.A30830>