From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16437 invoked from network); 8 Mar 2007 04:54:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.8 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Mar 2007 04:54:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 96264 invoked from network); 8 Mar 2007 04:54:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Mar 2007 04:54:50 -0000 Received: (qmail 28818 invoked by alias); 8 Mar 2007 04:54:43 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11241 Received: (qmail 28809 invoked from network); 8 Mar 2007 04:54:43 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 8 Mar 2007 04:54:43 -0000 Received: (qmail 95028 invoked from network); 8 Mar 2007 04:54:43 -0000 Received: from dan.emsphone.com (199.67.51.101) by a.mx.sunsite.dk with SMTP; 8 Mar 2007 04:54:40 -0000 Received: from dan.emsphone.com (dan@localhost [127.0.0.1]) by dan.emsphone.com (8.14.0/8.13.8) with ESMTP id l284sXGp093541 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 7 Mar 2007 22:54:33 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.0/8.14.0/Submit) id l284sXxa093539; Wed, 7 Mar 2007 22:54:33 -0600 (CST) (envelope-from dan) Date: Wed, 7 Mar 2007 22:54:33 -0600 From: Dan Nelson To: Atom Smasher Cc: zsh-users@sunsite.dk Subject: Re: unexpected wildcard issue Message-ID: <20070308045433.GQ86959@dan.emsphone.com> References: <20070308045130.66826.qmail@smasher.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070308045130.66826.qmail@smasher.org> X-OS: FreeBSD 6.2-STABLE User-Agent: Mutt/1.5.14 (2007-02-12) In the last episode (Mar 07), Atom Smasher said: > ### create some "xyz" file > $ touch {1..10}.xyz > > ### check that they're there, using a wildcard > $ ls *xyz > 0.xyz 1.xyz 10.xyz 2.xyz 3.xyz 4.xyz 5.xyz 6.xyz 7.xyz > 8.xyz 9.xyz > > ### create another file with a leading dash in the filename > $ touch ./-11.xyz > > ### check again, with a wildcard > $ ls *xyz > ls: illegal option -- . > usage: ls [-ABCFGHILPRSTWZabcdfghiklmnopqrstuwx1] [file ...] > > ::::::::::: > > should the shell protect expanded file names, as if they were entered > in quotes? Doesn't matter. Even if quoted, ls would still see as its first argument something starting with a dash, which it will interpret as an option. Use "ls -- *xyz" or "ls ./*xyz" to ensure that none of the expanded filenames get mistaken for options. -- Dan Nelson dnelson@allantgroup.com