Simple linux command line command to modify an option in a INI like config file

前端 未结 3 1743
北海茫月
北海茫月 2021-02-15 15:03

I am looking for a generic command line solution that would allow me to add or modify a configuration option inside a config file (ini like format).

Most linux configur

3条回答
  •  盖世英雄少女心
    2021-02-15 16:07

    git config is actually a semi-generic INI interface.

    ❱ git config --file=/etc/default/nginx somegroup.ULIMIT '-n 4096'
    ❱ cat /etc/default/nginx
    [somegroup]
        ULIMIT = -n 4096
    ❱ git config --file=/etc/default/nginx somegroup.ULIMIT
    "-n 4096"
    

    It doesn't support adding top-level keys, though. All keys have to be placed in an INI style group, hence the "somegroup." above. That makes it unsuitable for your task, but I thought I'd mention it here for others finding their way here.

提交回复
热议问题