automating copy files

Assume you have in a folder the following .c files

reference.c
test.c
test1.c
test2.c
...
testn.c

You want to copy the content of reference.c in all files (test, test1,..., testn)

Is there any shell command to automate this process?
type reference.c > test.c
Do you mean something like that?
I want to automatize the process. That means, with just single or two command I will able to copy the content of reference.c in all test files (test.c, test1.c, ...,testn.c).

for %a in (test*.c) do type reference.c > %a
think about it, simple batch -.-*
Last edited on
when I perform it I get the following error:

for %a in (*.c) do type reference.c > %a

bash: syntax error near unexpected token `('

any suggestion...
Last edited on
to copy the content of reference.c in all test files
¿Append, or they should be equal? I suppose that you can't just make a link.
¿Which shell are you using?
1
2
3
4
#!/bin/bash
for file in test*.c; do
  cp reference.c "$file"
done
Last edited on
Damn, sry, my version is vor MS-DOS.
Topic archived. No new replies allowed.