如何从Shell脚本修改INI文件? [英] How to modify INI files from shell script?

查看:524
本文介绍了如何从Shell脚本修改INI文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建vnc的自定义软件包,并希望确保在软件包安装后脚本中启用了GDM的xdcmp设置。 gdm.conf 文件是一种ini样式,即:

  [section] 
var = name

我要设置的值在整个配置文件的不同部分都有名称冲突。 / p>

是否有任何方法或工具可以轻松地从Shell脚本操作ini样式的配置文件?


我想在此进行分类 .deb postinst脚本。

解决方案

如果您愿意写一些Perl,有 Config :: IniFiles (包 libconfig-inifiles-perl )。


I'm building a custom package of vnc and would like to ensure the xdcmp settings of GDM are enabled in the package post install script. The gdm.conf file is an ini style one, i.e.:

[section]
var=name

And the value I want to set has name clashes in different sections throughout the config file.

Are there any methods or tools that allow for easy manipulation of ini style config files from shell scripts?

I'd like to sort this out in the .deb postinst script.

解决方案

If you're willing to write some Perl, there's Config::IniFiles (package libconfig-inifiles-perl).

这篇关于如何从Shell脚本修改INI文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆