Check ini style config tool

INI style config is like below

[section]
# comment
key = value

Sometimes we want to check the config and we do not care the empty line and comment. We can use below tool

[root@controller ~]# cat /opt/env/alias 
check_ini_style_conf()	
{
	# Read a ini conf, print lines not commented
	cat $1 | grep -v "#" | grep -v "^$"
}
alias ckcf=check_ini_style_conf

Load the file

. /opt/env/alias

Use the tool

[root@controller ~]# ckcf /etc/keystone/keystone.conf 
[DEFAULT]
admin_token = 793e836f9e0182ac5d44
[assignment]
[auth]
[cache]
[catalog]
[cors]
原文地址:https://www.cnblogs.com/kramer/p/6229420.html