var=FpingLocation
conf=$(whereis zabbix_server | sed "s/^.* //g")
echo $conf
fping=$(whereis fping | cut -d' ' -f2)
echo $fping
Check if the replacement works:sed "s|^.*$var=.*$|$var=$fping|" $conf | grep "^$var"
Replace:sed -i "s|^.*$var=.*$|$var=$fping|" $conf | grep "^$var"
Final check:grep "^$var" $conf
No comments:
Post a Comment