Is there a one-line command/script to copy one file to many files on Linux?
cp file1 file2 file3
copies the first two files into the third. Is there a way to copy the first file into the rest?
Is there a one-line command/script to copy one file to many files on Linux?
cp file1 file2 file3
copies the first two files into the third. Is there a way to copy the first file into the rest?
Use something like the following. It works on zsh.
or
It's good for small files.
You should use the cp script mentioned earlier for larger files.
You can use
shift
:cat file1 | tee file2 | tee file3 | tee file4 | tee file5 >/dev/null
You can use standard scripting commands for that instead:
Bash:
But there's a little typo. Should be:
And as mentioned above, that doesn't copy permissions.