Mahes Mahes - 10 months ago 54
Bash Question

Creating files with some content with shell script

I need to configure a server with few file and i want to do it programatically.

i need to create files say /home/a.config, /var/spool/b.config, /etc/c.config

above files have some contents (multi lines).

i want to create ONE shell script which can create all three file with multiple lines (around 10).
i would like to know the how can i use CAT command to do that. (inside shell script).

i am looking somehting like this

echo " going to create /home/a.config"

cat "HOW CAN I HAVE MULTIPLE LINES HERE?? " > /home/a.config



You can use a here document:

cat <<EOF >/home/a.config
first line
second line
third line

You can place several of these in the same script.