I want to echo some unique string to a file. Sample code like bellow:
{
echo " LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined"
echo " LogFormat "%h %l %u %t \"%r\" %>s %b" common"
} >> file.conf
When i run it, file.conf become seperate in to 2 file. How i can echo it with a correct way?
Thank You
>
redirection in the string you're trying to echo, so the output goes to files
. Either escape the quotes within the quotes, or put the whole string in single-quotes ('
) so you can include double-quotes (and backslashes) without quoting.
– ilkkachu Mar 20 '17 at 06:15echo ' LogFormat "%h %l %u %t \"%r\" %>s %b" common'