Skip to content

Instantly share code, notes, and snippets.

View nhr's full-sized avatar

N. Harrison Ripps nhr

View GitHub Profile
@nhr
nhr / gist:f86974c733cd5edeb8b2
Created September 24, 2014 13:33
Bash helper functions for capturing eth0 IP addr and public IP addr
function get_eth0_ipaddr() {
eth0_ip=$(ip addr list eth0 | grep 'inet ' | tr -s ' ' | cut -d ' ' -f 3 | cut -d '/' -f 1)
echo "${eth0_ip}"
}
function get_public_ipaddr() {
public_ip=$(curl -s ipecho.net/plain)
echo "${public_ip}"
}