From owner-freebsd-questions Thu Mar 29 7:43:36 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dsl-64-193-218-89.telocity.com (dsl-64-193-218-89.telocity.com [64.193.218.89]) by hub.freebsd.org (Postfix) with SMTP id B0C0B37B71E for ; Thu, 29 Mar 2001 07:43:31 -0800 (PST) (envelope-from lucas@slb.to) Received: (qmail 25390 invoked by uid 1000); 29 Mar 2001 15:43:51 -0000 Date: Thu, 29 Mar 2001 09:43:50 -0600 From: Lucas Bergman To: CB Cc: freebsd-questions@freebsd.org Subject: Re: cd with wildcards (Was: subjectless) Message-ID: <20010329094350.A30830@billygoat.slb.to> Reply-To: lucas@slb.to References: <1.5.4.32.20010327235125.0066b348@JEAH.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i 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 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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