是否有修改 .conf 文件的程序/脚本?

elo*_*esp 5 linux bash shell

我想/etc/gdm/custom.conf 从 shell 或脚本修改文件。

# GDM configuration storage
[xdmcp]
[debug]
[daemon]
AutomaticLoginEnable=true;
AutomaticLogin=username;
Run Code Online (Sandbox Code Playgroud)

但我的想法是,我可以在一个节中添加一行,并检查该节是否已定义(如果没有,则添加定义),属性已定义,让它取消定义(删除该行),(并删除节标题)如果没有定义属性)等...

除了gconftool-2我没有找到任何东西,但它没有解释如何修改其他文件。(那里有一个shema文件)。

elo*_*esp 5

Augeas是一个:一个命令行工具,用于从 shell(和 shell 脚本)操作配置。(除其他事项外)

它使用镜头将每个文件转换为 xml,提供特殊工具来编辑它们,并使用镜头将文件写回本机格式。


pix*_*eat 5

你可以试试克鲁迪尼

crudini --set /etc/gdm/custom.conf daemon AutomaticLoginEnable 'true;'
Run Code Online (Sandbox Code Playgroud)