zsh-users
 help / color / mirror / code / Atom feed
* Brace Expansion
@ 2004-04-23 13:15 zzapper
  2004-04-23 13:41 ` Thorsten Kampe
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: zzapper @ 2004-04-23 13:15 UTC (permalink / raw)
  To: zsh-users

Hi,

This must be an old zsh chestnut EXCEPT I couldn't Google a solution

I want to do a

> ls -l *.{cfm,htm,html}

Which I could also do in bash.

In my cygwin-zsh 4.2.0 this works fine UNLESS one of the file
extensions is ABSENT, when instead of list the remaining file types it
gives an error message.

>\ls -t *.{html,cfm,htm}
zsh: no matches found: *.htm


zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Brace Expansion
  2004-04-23 13:15 Brace Expansion zzapper
@ 2004-04-23 13:41 ` Thorsten Kampe
  2004-04-23 14:00 ` Peter Stephenson
  2004-04-23 14:11 ` Peter Stephenson
  2 siblings, 0 replies; 6+ messages in thread
From: Thorsten Kampe @ 2004-04-23 13:41 UTC (permalink / raw)
  To: zsh-users

* zzapper (2004-04-23 15:15 +0100)
> This must be an old zsh chestnut EXCEPT I couldn't Google a solution
> 
> I want to do a
> 
>> ls -l *.{cfm,htm,html}
> 
> Which I could also do in bash.
> 
> In my cygwin-zsh 4.2.0 this works fine UNLESS one of the file
> extensions is ABSENT, when instead of list the remaining file types it
> gives an error message.
> 
>>\ls -t *.{html,cfm,htm}
> zsh: no matches found: *.htm

Options nomatch, badpattern and cshnullglob (says my new option list)

Thorsten


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Brace Expansion
  2004-04-23 13:15 Brace Expansion zzapper
  2004-04-23 13:41 ` Thorsten Kampe
@ 2004-04-23 14:00 ` Peter Stephenson
  2004-04-23 14:13   ` zzapper
  2004-04-23 14:11 ` Peter Stephenson
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2004-04-23 14:00 UTC (permalink / raw)
  To: zsh-users

zzapper wrote:
> > ls -l *.{cfm,htm,html}
>
> >\ls -t *.{html,cfm,htm}
> zsh: no matches found: *.htm

The correct way to do this is
  ls -l *.(cfm|htm|html)
Then you'll only get `no matches' if none of the variants matched, which
is presumably what you want.

Brace expansion is not part of globbing; it generates `*.html *.cfm
*.htm' before the patterns are examined.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Brace Expansion
  2004-04-23 13:15 Brace Expansion zzapper
  2004-04-23 13:41 ` Thorsten Kampe
  2004-04-23 14:00 ` Peter Stephenson
@ 2004-04-23 14:11 ` Peter Stephenson
  2004-04-23 16:14   ` zzapper
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2004-04-23 14:11 UTC (permalink / raw)
  To: zsh-users

zzapper wrote:
> This must be an old zsh chestnut EXCEPT I couldn't Google a solution

By the way, you might want to try the manual as well as Google.

BRACE EXPANSION

...

     Note that brace expansion is not part of filename generation
     (globbing);  an expression such as */{foo,bar} is split into
     two separate words */foo and */bar before  filename  genera-
     tion  takes  place.  In particular, note that this is liable
     to produce a `no match' error if either of the  two  expres-
     sions  does  not  match;  this  is  to  be  contrasted  with
     */(foo|bar), which is treated as a single pattern but other-
     wise has similar effects.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Brace Expansion
  2004-04-23 14:00 ` Peter Stephenson
@ 2004-04-23 14:13   ` zzapper
  0 siblings, 0 replies; 6+ messages in thread
From: zzapper @ 2004-04-23 14:13 UTC (permalink / raw)
  To: zsh-users

On Fri, 23 Apr 2004 15:00:43 +0100,  wrote:

>zzapper wrote:
>> > ls -l *.{cfm,htm,html}
>>
>> >\ls -t *.{html,cfm,htm}
>> zsh: no matches found: *.htm
>
>The correct way to do this is
>  ls -l *.(cfm|htm|html)
>Then you'll only get `no matches' if none of the variants matched, which
>is presumably what you want.
>
>Brace expansion is not part of globbing; it generates `*.html *.cfm
>*.htm' before the patterns are examined.

ls *.(Thanks|Merci|Dankeshoen|Gratzi)

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Brace Expansion
  2004-04-23 14:11 ` Peter Stephenson
@ 2004-04-23 16:14   ` zzapper
  0 siblings, 0 replies; 6+ messages in thread
From: zzapper @ 2004-04-23 16:14 UTC (permalink / raw)
  To: zsh-users; +Cc: zsh-workers

On Fri, 23 Apr 2004 15:11:30 +0100,  wrote:

>zzapper wrote:
>> This must be an old zsh chestnut EXCEPT I couldn't Google a solution
>
>By the way, you might want to try the manual as well as Google.

Did try the manual, but as I was barking up the wrong tree, so it
didn't help!!

>
>BRACE EXPANSION
>
>...
>
>     Note that brace expansion is not part of filename generation
>     (globbing);  an expression such as */{foo,bar} is split into
>     two separate words */foo and */bar before  filename  genera-
>     tion  takes  place.  In particular, note that this is liable
>     to produce a `no match' error if either of the  two  expres-
>     sions  does  not  match;  this  is  to  be  contrasted  with
>     */(foo|bar), which is treated as a single pattern but other-
>     wise has similar effects.

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-04-23 16:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 13:15 Brace Expansion zzapper
2004-04-23 13:41 ` Thorsten Kampe
2004-04-23 14:00 ` Peter Stephenson
2004-04-23 14:13   ` zzapper
2004-04-23 14:11 ` Peter Stephenson
2004-04-23 16:14   ` zzapper

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).