现在有一个配置文件, 假设路径 /opt/tomcat/webapps/app/WEB-INF/class/config.propertiesapp.jdbc.driver=com.mysql.jdbc.Driverapp.jdbc.url=jdbc:mysql://192.168.1.5:3306/app?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=trueapp.jdbc.user=rootapp.jdbc.password=123456hibernate.jdbc.batch_size=500executor.queue.capacity=25000hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialecthibernate.hbm2ddl.auto=nonehibernate.show_sql=falsehibernate.format_sql=falsehibernate.use_sql_comments=true编写一段 Bash 实现,修改 IP / username / password 三项的值
2 回答

josephxia
TA贡献76条经验 获得超38个赞
不想先直接回答这个问题 因为你遇到的应用场景根本就不适合你说的实现方式
最常见的实现方式是在文件夹中预存多个文件然后通过替换文件的方式完成。比如cofig_test(测试环境) config_prd(生产)
或者 在版本服务器上(git)生产分支和测试使用不同的配置文件
写个替换的shell不是不行 估计比配置文件还复杂 没有意义
- 2 回答
- 0 关注
- 1398 浏览
添加回答
举报
0/150
提交
取消