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

Re: Copy a file one hundred times



Hi Rodolfo

On Sat, Dec 13, 2008 at 8:12 PM, Rodolfo Medina
<rodolfo.medina@gmail.com> 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.


#!/bin/bash

for x in `seq 1 100`; do

    if [[ x -lt  10 ]]; then cp file.jpg file-00$x.jpg;

  elif [[ x -lt 100 ]]; then cp file.jpg file-0$x.jpg;

  else cp file.jpg file-$x.jpg;

  fi

done


Greetings, Manon.


Reply to: