Concatenate strings, files and program output in Bash
You can add all the commands in a subshell, which is redirected to a file:
( cat 1.css echo "FOO" sed ... echo BAR cat 2.css) > output
You can also append to a file with >>
. For example:
cat 1.css > outputecho "FOO" >> outputsed ... >> outputecho "BAR" >> output cat 2.css >> output
(This potentially opens and closes the file repeatedly)
You can do:
echo "$(command 1)" "$(command 2)" ... "$(command n)" > outputFile