2007-09-21 20:52:12 +00:00
|
|
|
function __fish_print_addresses --description "Print a list of known network addresses"
|
2017-02-13 16:30:38 +00:00
|
|
|
if command -sq ip
|
2018-04-15 16:58:53 +00:00
|
|
|
command ip --oneline address | string replace -r '(\S+\s+){3}(.+)/.*' '$2'
|
2017-02-13 16:30:38 +00:00
|
|
|
else if command -sq ifconfig
|
2016-11-28 05:27:22 +00:00
|
|
|
# This is for OSX/BSD
|
|
|
|
# There's also linux ifconfig but that has at least two different output formats
|
|
|
|
# is basically dead, and ip is installed on everything now
|
|
|
|
ifconfig | awk '/^\tinet/ { print $2 } '
|
|
|
|
end
|
2007-09-21 20:52:12 +00:00
|
|
|
end
|
|
|
|
|