Command line INI / config file editor
Hello,
What I am trying to do is create an easy way to install a mail server in Debian. So I want ask the user for some value and then enter that value in PHP.INI or postfix master.cf etc. Is there any way I can change the config files from command line? |
"sed" is a stream editor. It can be used to edit files programatically, from command lines or from a script. It's not the friendliest thing in the world though :p
|
Thanks,
I already use sed for simple things like replacing xxxx = On to xxxx = Off the main problem is with postfix master.cf where I need to add/modify lines in a specific place For example: in the smtp service line I need to add Code:
smtp inet n - - - - smtpd below that I need to add: Code:
spamassassin unix - n n - - pipe |
You an use pattern matching to select a line and the `a' command to add a line below the one that was matched:
sed '/user=spamd/a\ /usr/sbin/sendmail -oi -f ${sender} ${recipient}' master.cf >master.cf.new Another technique could be to collect all of the variable parts of master.cf, from the old one & the user, and then construct a new one in it's entirety using a HERE document with variables. |
Thanks will try that
|
All times are GMT -5. The time now is 05:46 AM. |