Bash/Zsh brace expansion; Re: [plug] clone files - increment name

Alastair Irvine alastair at ucc.gu.uwa.edu.au
Mon Sep 1 12:30:10 WST 2008


On Mon, 28 Jul 2008 08:27 pm, Keith Bawden wrote:

>
> for i in {1..100} ; do cp image.jpg `printf "image%03d.jpg" $i` ;
> done

Thanks for the tip, Keith.  It appears that you're a bit ahead of 
the curve though, because this feature is not supported in older 
versions of Bash (e.g., version 2.05b.0(1)-release from Debian 
Sarge):

	> cat /etc/debian_version
	3.1
	> bash -c 'for i in {1..10} ; do echo $i ; done'
	{1..10}

As mentioned by Daniel Pittman in a later reply, this isn't 
supported at all by shells other Bash and Zsh.  (pdKSH anyone?)

-- 
Alastair Irvine, Warpspace IT <http://www.warpspace.net/>
Business enquiries: 1300 881744 or guru at warpspace.net
[Linux Counter user #404151; OpenDocument Format Alliance member]



More information about the plug mailing list