file_line, replace = true, does this also append if match is not found?

asked 2018-11-26 04:05:59 -0600

jongm0816 gravatar image

updated 2018-11-27 22:39:15 -0600

What I need is replace the value of a variable in the config file. But if the variable is not found, append the $line.

line => '$myfqdn'

Replace if:

$ grep ^myhostname /etc/postfix/main.cf

myhostname=<any value="">

$

Append if:

$ grep ^myhostname /etc/postfix/main.cf

$

edit retag flag offensive close merge delete