I have a bash script and I have a string with some \n
:
interfaces="auto lo\niface lo inet loopback\n\n..."
Then I try to write this into the interfaces file like so:
sudo bash -c "echo -e $interfaces > /etc/network/interfaces"
I use -e
to display the \n
's but if I open the file it doesn't show right but if I just output it to the terminal it works:
auto loniface lo inet loopbacknn...