- 论坛徽章:
- 8
|
- [root@me shell]# cat render.sh
- #!/bin/bash
- echo "$1" > b.conf
- awk -F"[={} ]+" 'FILENAME==ARGV[1]{b=split($0,a,",");for(i=1;i<=b;i++){match(a[i],"\042([^\"]+)\042:\042([^\"]+)",c);d[c[1]]=c[2]}}d[$2]{print $1"="d[$2]>"result.conf"}' b.conf a.conf
- [root@me shell]# cat b.conf
- {"name":"abc","app_path":"/usr/local","sex":"man"}
- [root@me shell]# cat result.conf
- program=abc
- directory=/usr/local
- [root@me shell]# bash render.sh '{"name":"abc","app_path":"/usr/local","sex":"man"}'
- [root@me shell]# cat result.conf
- program=abc
- directory=/usr/local
- [root@me shell]#
复制代码
回复 5# wh7211
三个参数怎么就不行了呢
|
|