mardi 30 décembre 2014

Concatenate and pass as parameter, bash


Need some help with removing default gateway. For example, there is an IP 192.168.4.15 with default gateway 192.168.4.14. I connect to WLAN with gw 10.0.0.1 and after that I would like do remove previous gw.



IFS='.' read -ra IPARR <<< "$IP"
Gateway="${IPARR[0]}.${IPARR[1]}.${IPARR[2]}.14"
ssh blah@$IP '/sbin/route -v del default gw $Gateway;'
#ssh blah@$IP '/sbin/ip route delete $Gateway dev rndis0;'
#ssh blah@$IP '/sbin/route -n'


Both ways don't work. However, it is possible to remove it if I ssh into machine. My guess is that something wrong with passing $Gateway variable. Any suggestions?



Aucun commentaire:

Enregistrer un commentaire