标签:int roo type 判断 print shel 文件中 echo $2
$ ./ip.sh ‘8.8.8.1‘
#!/bin/bash
#localIP=$(command)
#
localIP=‘/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|grep 8|awk ‘{print $2}‘|tr -d "addr:"‘
for ip in $(< /home/.../conf/env.json);do if [ ${ip} == "9.9.0.224" ] then sed -i ‘s/${ip}/${localIP}/g‘ /../env.json elif [ ${ip} == "9.9.0.18" ] then sed -i ‘s/${ip}/$1/g‘ /../env.json fi done
$ ./env.sh test
1.Ansible调用各个Agent脚本执行,判断envtype="solution"时更新为$1
2.ssh root@${ip}
"sed -i ‘s/1/3/g‘ /home/../json"
for file in /home/../*.json do echo "$file:" for ... done done
4.判断是哪个环境
for file in /home/.../* if [ -d "$file" && "$file"=="taskserver" ] then echo "$file means localhost is server" elif [ -d "$file" && "$file" == "taskmaster"] then echo "" elif [ -d "$file" && "$file" == "env_agent"] then echo "" fi done
标签:int roo type 判断 print shel 文件中 echo $2
原文地址:https://www.cnblogs.com/cevinchen/p/9410749.html