Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

my ip

my_ip=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')

my_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ip
ADD COMMENT
Topic
Name
8+4 =