Writing to multiple files with cat

I have a some empty html files that i want to write. I am trying this

cat account_settings/account_settings.html >> assets/assets.html, users/users.html

to attempt to write to the files assets.html and users.html.

How can I write to multiple files?


You can use the tee command

NAME
       tee - read from standard input and write to standard output and files

e.g.

cat account_settings/account_settings.html | tee -a assets/assets.html users/users.html

or (using input redirection)

tee -a assets/assets.html users/users.html < account_settings/account_settings.html

As noted in the manual page, tee also outputs the contents to the terminal (standard output) - if you don't want to see that, redirect stdout to null

tee -a assets/assets.html users/users.html < account_settings/account_settings.html > /dev/null

Just for-loop over the list of files you want

for file in assets/assets.html users/users.html
do
    cat account_settings/account_settings.html >> "$file"
done