sed.bash

2021-01-15  本文已影响0人  HaoDongZ
#!/bin/bash

filepath="/abc/application/bas/agent/config/agent.config"
appnames="zhd"
echo $appnames
ipaddress=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
echo $ipaddress
hostnames=`hostname`
echo $hostnames

sed -i  "s/appname/${appnames}/g"   $filepath
sed -i "s/ipaddr/${ipaddress}/g"    $filepath
sed -i "s/hostname/${hostnames}/g"  $filepath
cat agent.config.bak |grep -v  "^#"|grep -v "^$"
agent.service_name=${SW_AGENT_NAME:appname}
agent.instance_name=${SW_AGEENT_INSTANCE_NAME:hostname:ipaddr}
上一篇 下一篇

猜你喜欢

热点阅读