Update var in ini file using bash

前端 未结 4 1444
我寻月下人不归
我寻月下人不归 2021-01-02 02:55

I am attempting to write a bash script to configure various aspects of a server. The context here is replacing a value of a variable in a conf file (ini format) with another

4条回答
  •  我在风中等你
    2021-01-02 03:00

    awk '/^[ssh-iptables/ {ok=1}
         ok==1 && $0="enabled = false" {print "  enabled = true"; ok=0 ; next}
         {print $0} ' infile > tmp
         mv tmp infile
    

提交回复
热议问题