Sunday, April 1, 2018

variable linux ip dan interface


my_ip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
my_interface=$(ip route get 8.8.8.8 | awk '/dev/ {f=NR} f&&NR-1==f' RS=" ")

No comments:

Post a Comment