How to write multiple line string using Bash with variables?
Solution:
For one record in config file:
#!/bin/bashvar1="abc"var2="xyz"cat >/etc/config.conf <<EOLline 1, ${var1}line 2,line 3, ${var2}line 4 line...EOLcat /etc/config.conf
For multiple record in config file:
#!/bin/bashvar1="abc"var2="xyz"for i in `cat sometext.txt`docat >>/etc/config.conf <<EOLline 1, ${var1}line 2,line 3, ${var2}line 4 line...EOLdone
No comments