Skip to content

Instantly share code, notes, and snippets.

@linben
Created April 3, 2017 08:41
Show Gist options
  • Save linben/1bb269741afcabe10a48bc53b4882cc7 to your computer and use it in GitHub Desktop.
Save linben/1bb269741afcabe10a48bc53b4882cc7 to your computer and use it in GitHub Desktop.
ip-detect
#!/usr/bin/env bash
set -o nounset -o errexit
export PATH=/usr/sbin:/usr/bin:$PATH
echo $(ip addr show eth0 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment