[nagios@SHQZ-PS-WCITY-SV-MON01 hostxiugai]$ cat bash.sh
for i in `cat ho.ip`
do
sed "s#123456#$i#g" /data0/software/nagios/hostxiugai/s.txt >> /data0/software/nagios/etc/services.cfg
done
sed引用变量要用 双引号“”
for i in `cat ho.ip`
do
sed "s#123456#$i#g" /data0/software/nagios/hostxiugai/s.txt >> /data0/software/nagios/etc/services.cfg
done
sed引用变量要用 双引号“”
转载于:https://blog.51cto.com/lengxuezhixuan/1322271