Skip to content

Instantly share code, notes, and snippets.

@Juszczak
Created March 20, 2018 14:25
Show Gist options
  • Select an option

  • Save Juszczak/152afe0ecd812c1047a287e08a806825 to your computer and use it in GitHub Desktop.

Select an option

Save Juszczak/152afe0ecd812c1047a287e08a806825 to your computer and use it in GitHub Desktop.
Fast IP info by greping ifconfig for local and DNS lookup for global (used as tmux plugin)
#!/usr/bin/env bash
declare glob; glob="$(dig +short myip.opendns.com @resolver1.opendns.com)";
declare local; local="$(ifconfig en4 | grep 'inet ' | awk '{print $2}')"
declare out; out="$local | $glob"
echo "$out"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment