zsh-users
 help / color / mirror / code / Atom feed
* Repeat argument N times?
@ 2014-07-30  3:12 Benjamin R. Haskell
  2014-07-30  6:48 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin R. Haskell @ 2014-07-30  3:12 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Is there a built-in way to repeat an argument N times?

Brace expansion is something I fall back on too much, so I've gotten in the
habit of using it for small values of N, e.g. with a script I use to test
uploading files to a web app:

    upload-files file1{,,} file2{,}{,,,,} file3{,,,}

uploads 3 copies of file1, 10 copies of file2, and 4 copies of file3.

It'd be nice if I could write (something like):

    upload-files file1(N3) file2(N10) file3(N4)

Today I found myself writing:

    upload-files file1{,}{,,,,}{,}{,,,,}

And while it's nice to know I can factor 100, it'd be nicer to just write
it.

-- 
Best,
Ben

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

end of thread, other threads:[~2014-07-31 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-30  3:12 Repeat argument N times? Benjamin R. Haskell
2014-07-30  6:48 ` Bart Schaefer
2014-07-30  8:56   ` Peter Stephenson
2014-07-30 14:10     ` Roman Neuhauser
2014-07-30 14:41       ` Roman Neuhauser
2014-07-31 15:59   ` Mikael Magnusson

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