Hi Raul! Keep in mind that the shell expands any metacharacters (wildcards) before it is passed to the command. In this case, it **tried** expand "file[1-5]" but couldn't as there are no files in the current directory named file1, file2 and so forth. Therefore nothing gets expanded and the expression "file[1-5]" is assigned to the variable "f" with no expansion. Try: for f in 1 2 3 4 5 ; do cp file file${f} ; done I think that'll do what you need. However, Chris' example is great if you want to have a large number of copies or want to change the number of copies for different file. Regards, jimmo On Tuesday 05 February 2002 17:18, Raúl Gutiérrez Segalés wrote:
Hi:
How can I make lots(for example 5) of copies of a file.. (from the command line, not writing a script).
I tried this but it didnt work..:
$ for f in "file[1-5]" ; do `cp file $f` ; done
and it made a copy called file[1-5] :-(
Any pointers??
Thanks!
Raul
-- --------------------------------------- "Science has promised man power...But, as so often happens when people are seduced by promises of power, the price is servitude and impotence. Power is nothing if it is not the power to choose." Joseph Weizenbaum of MIT said in reference to Computers. --------------------------------------- The Great Linux-NT Debate: <http://www.jimmo.com/Linux-NT_Debate/index.html> --------------------------------------- NOTE: All messages sent to me in response to my posts to newsgroups or forums are subject to reposting.