[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copy a file one hundred times



On Sat, Dec 13, 2008 at 07:12:32PM +0000, Rodolfo Medina wrote:
> I need the right syntax to copy file.jpg 100 times with one command so to get
> 100 files named file1.jpg, file2.jpg, ..., file100.jpg.
> 
> Can anybody suggest how to achieve that?

c=0; while [ $c -lt 100 ]; do c=$[c + 1]; n='000'$c; cp file.jpg file${n: -3}.jpg; done

-- 
"Never compromise principle, not even on special occasions."
		--- Robert Bitzer (quoted by Marcia Pearce;
		    quoted in Diane Dreher 1996
		    _The Tao of Personal Leadership_ pg 221)
    Rick Pasotto    rick@niof.net    http://www.niof.net


Reply to: