zsh-users
 help / color / mirror / code / Atom feed
From: Dan Nelson <dnelson@allantgroup.com>
To: Atom Smasher <atom@smasher.org>
Cc: zsh-users@sunsite.dk
Subject: Re: unexpected wildcard issue
Date: Wed, 7 Mar 2007 22:54:33 -0600	[thread overview]
Message-ID: <20070308045433.GQ86959@dan.emsphone.com> (raw)
In-Reply-To: <20070308045130.66826.qmail@smasher.org>

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


  reply	other threads:[~2007-03-08  4:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-08  4:51 Atom Smasher
2007-03-08  4:54 ` Dan Nelson [this message]
2007-03-08  5:12   ` Atom Smasher
2007-03-08 17:47     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070308045433.GQ86959@dan.emsphone.com \
    --to=dnelson@allantgroup.com \
    --cc=atom@smasher.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).