]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/addr
argv: turns arguments into lines (useful for testing shell quotes)
[dotfiles.git] / bin / addr
1 #!/bin/sh
2 # Usage: addr [<if>]
3 # Show IPv4 address for interface <if> or all interfaces with
4 # no <if> given.
5
6 # Darwin/OSX
7 ifconfig -a |
8 grep 'inet ' |
9 grep broadcast |
10 awk '{ print $2 }'
11
12 # Linux
13 ifconfig -a |
14 grep 'inet ' |
15 grep Bcast |
16 awk '{ print $2 }'