zsh-users
 help / color / mirror / code / Atom feed
* Expansion of patterns
@ 2005-03-09 12:04 Hugo Haas
  2005-03-09 12:43 ` J
  0 siblings, 1 reply; 2+ messages in thread
From: Hugo Haas @ 2005-03-09 12:04 UTC (permalink / raw)
  To: zsh-users

Hi.

I've been wanting to expand patterns that do not match filenames. For
example:

  echo a1 a2 a3

could be (hopefully) written:

  echo a[1-3]

However, I get:

  zsh: no matches found: a[1-3]

I sure can do:

  (for i in $(seq 1 3); do echo a$i; done)| xargs echo

but it clearly isn't as simple, and it works for simple cases but
wouldn't work in complex ones.

Is there any way to expand patterns like this in a simple way?

Cheers,

Hugo

-- 
Hugo Haas - http://larve.net/people/hugo/


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

* Re: Expansion of patterns
  2005-03-09 12:04 Expansion of patterns Hugo Haas
@ 2005-03-09 12:43 ` J
  0 siblings, 0 replies; 2+ messages in thread
From: J @ 2005-03-09 12:43 UTC (permalink / raw)
  To: Hugo Haas; +Cc: zsh-users

> I've been wanting to expand patterns that do not match filenames. For
> example:
> 
>  echo a1 a2 a3
> 
> could be (hopefully) written:
> 
>  echo a[1-3]
> [...]
> Is there any way to expand patterns like this in a simple way?

For this one you can just write a{1..3} which should work the way you
expect. Note that it does keep leading zeroes, so that a{01..03} will
produce
a01 a02 a03.

-- 
J
"- Watashi, DATE-tte hajimete datta no...
 - Sou kai ?
 - Hontou wa suki na hito to surun deshou ?" -- Tokugawa Asuka


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

end of thread, other threads:[~2005-03-09 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-09 12:04 Expansion of patterns Hugo Haas
2005-03-09 12:43 ` J

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