Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Repeat argument N times?
- X-seq: zsh-users 18998
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Repeat argument N times?
- Date: Tue, 29 Jul 2014 23:12:34 -0400
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Sender: benizi@xxxxxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author