Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: unexpected wildcard issue
- X-seq: zsh-users 11241
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- To: Atom Smasher <atom@xxxxxxxxxxx>
- Subject: Re: unexpected wildcard issue
- Date: Wed, 7 Mar 2007 22:54:33 -0600
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20070308045130.66826.qmail@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070308045130.66826.qmail@xxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author