Reputation: 2160
I would like to add this code to the end of a file:
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
How can I do this while keeping the structure and slashes?
I tried using echo
line by line as well as this without success:
cat > /etc/default/varnish <<- EOM
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
EOM
Upvotes: 1
Views: 306
Reputation: 785058
Use quotes around here-doc identifier to avoid shell expansion:
cat >> /etc/default/varnish <<-'EOM'
DAEMON_OPTS="-a :80 \ -T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
EOM
As per man bash
:
If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded.
Upvotes: 2