Mga master, patulong po.
Baguhan lang ako sa Linux scripting.Tulong po sana.
Gawa kasi ako ng auto routing script ng android.
Ang gusto ko mangyari
1. kunin ang value ng gateway IP ng eth0 - lagay sa variable like 'x'
Sample ipv = 192.168.1.2
Gateway = 192.168.1.1
X = 192.168.1.1
Then
2. Mag a add ako ng default route
IP route add default via %X dev eth0
Sorry newbie pa talaga
baka Alam nyo po pano gawin.
TIA
route -n to display routing table, then pipe result to awk
$4 is flags, UG means UP and GATEWAY
$8 is iface, palitan mo nalang ng interface name wlp2s0 sakin
$2 is ip address
To assign the output of your command do: var=$(command), avoid whitespace around the assignment operator
IDK pano mag add ng default route lol i-SO mo nlng
Disclaimer: wala akong alam sa android, nakita ko lang linux and ito yung gumagana sakin