function joey_read_value
{
if [ $# -ne 1 ]; then
joey_wrong_log "***Exit joey_read_value"
exit 1
fi
typeset joey_local_key=$1
if [ ! -f ${joey_config_file_name} ];then
joey_wrong_log "The config file not a file.config file is:${joey_config_file_name}"
echo "some thing wrong in easy_work.see the log:${joey_log_file}"
exit 1
fi
####
typeset joey_local_count=`cat ${joey_config_file_name}|awk -F= -v k="${joey_local_key}" '{ if ( $1 == k ) print $2 }'|wc -l`
if [ ${joey_local_count} -ge 2 ];then
joey_wrong_log "There are two same key in the config file.So the config wrong!"
joey_wrong_log "The key is :${joey_local_key}"
echo "some thing wrong in easy_work.see the log:${joey_log_file}"
exit 1
fi
if [ ${joey_local_count} -eq 1 ];then
typeset joey_local_value=`cat ${joey_config_file_name}|awk -F= -v k="${joey_local_key}" '{ if ( $1 == k ) print substr($0,(length($1)+2),length($0)) }'`
if [ $? -ne 0 ];then
joey_wrong_log "read the key in config Failed!Key:${joey_local_key}"
echo "some thing wrong in easy_work.see the log:${joey_log_file}"
exit 1
else
if [ "X${joey_local_value}" = "X" ];then
joey_wrong_log "read the key in config ,the key value is null!Key:${joey_local_key}"
echo "some thing wrong in easy_work.see the log:${joey_log_file}"
exit 1
else
joey_return=${joey_local_value}
return 0
fi
fi
else
joey_wrong_log "Can't find the value of the specified key \"${joey_local_key}\"!"
echo "some thing wrong in easy_work.see the log:${joey_log_file}"
exit 1
fi
}
分享到:
相关推荐
Java属性文件 如何在Java中读取config.properties值? 主跑 java crunchify / com / tutorial / CrunchifyReadConfigMain 参考
今天小编就为大家分享一篇关于Java语言读取配置文件config.properties的方法讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
Eclipse国际化插件 读取 .properties的中文文件
js读取properties文件,很好用的。js读取properties文件,很好用的。js读取properties文件,很好用的。js读取properties文件,很好用的。
ConfigFile configfile = ConfigFile.getInstance("ipConfig123.properties"); String ip = configfile.getkeyvalue("ip"); 可以取出ipConfig123.properties 文件中IP的内容
Java配置文件读取,采用单例模式加载config.properties
写好的读取properties配置文件的PropertiesConfig.java类,只需new个对象,PropertiesConfig config = new PropertiesConfig(); config.setPropertiesDataSource("/jdbc.properties"); config.getString(...
config.properties 文件并将其用作其基本配置 读取 config.xml 文件以决定启动哪些连接器 接收从每个连接器提取的数据并决定是否以及如何处理它(基本上,如果有任何模型) 为模型实例提供以下功能:在目标数据库上...
大家都喜欢把配置文件放在src目录下,如果有10个以上的配置文件为什么不考虑在WEB-INF目录下新建一个文件夹,专门放配置文件;这样即好管理,文件安全性又高。亲问题已经解决,把源代码共享给大家,已经通过测试;...
1约会nacos-config pom文件 2创建jdbc.properties配置nacos信息 3配置中心(nacos)增加规则 4给服务.properties中添加配置 5动态获取配置注解 @RefreshScope //动态获取并刷新配置 @Value(“ $ {配置项的名}”)
纯java底层读取配置文件,生成map,可以根据key模糊匹配查询,封装好了方法。比如getVal("spring.dubbo*url")
Kafka游戏机消费者 控制台应用程序,用于从给定的时间戳读取事件。 要求 Java> = 8 建造 ./mvn install ...spring.kafka.properties.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule
conf 这是一个解决Java开发中读取配置文件每次都要重写的困惑。 特性 开箱即用,简单方便 ...Config config = ConfigLoader.load("appconf.properties"); String name = config.getString("name"); Syste
此项目支持jdk8并且读取access不限制1000条; tips: 导出时候config文件夹不会被导出,这个文件夹里的file.properties是配置连接信息及用户名密码的; 如果file.properties里的中文显示为code,你需要右击此文件,...
服务端有2个配置文件,分别是serverConfig.properties和rulesConfig.properties serverConfig.properties文件用于配置程序的工作参数 rulesConfig.properties文件用于配置文件的更新规则 配置文件的位置 配置文件...
private static final String PFILE ="Config.properties"; /** * 对应于属性文件的文件对象变量 */ private File m_file = null; /** * 属性文件的最后修改日期 */ private long m_...
你可能知道在WinForm应用程序中可以利用Properties.Settings来进行类似的工作,但这些其实都利用了App.config配置文件。 本文探讨用代码的方式访问 App.config 的方法。关于 App.config 的使用远比上面提到的用途...
到目前为止,唯一的方法实现是从config.properties文件中读取属性值。I.检索慈善机构列表,并确认圣约翰已包含在该列表中。 该测试方案是在/src/test/java/apitest/Charities.java文件中实现的。 这些测试是junit...
构建程序:为了构建程序,目录中必须存在以下文件:Simulation.java、... 从文件 (config.properties) 中读取它们项目期间解锁成就:N40 N41 I24 I25 D9 I22 K31 K32 S51 123 G16 H19 Q47 将来可能添加的内
你只要把传入的参数里的文件内容读取出来,然后按照你自定义的判断 注释、内容、总数、包声明、导入数、空白行数然后一个一个的设入到传入的result参 数里就可以了(没有的可以不设)。具体的可以参照简单的下面给...