diff --git a/share/functions/__fish_print_addresses.fish b/share/functions/__fish_print_addresses.fish index 578c9f632..fd8c60351 100644 --- a/share/functions/__fish_print_addresses.fish +++ b/share/functions/__fish_print_addresses.fish @@ -2,7 +2,10 @@ function __fish_print_addresses --description "Print a list of known network add if command -s ip >/dev/null command ip --oneline address | cut -d" " -f7 | sed "s:\(.*\)/.*:\1:" else if command -s ifconfig >/dev/null - command ifconfig |sgrep 'inet addr'|cut -d : -f 2|cut -d ' ' -f 1 + # 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 end diff --git a/share/functions/__fish_print_interfaces.fish b/share/functions/__fish_print_interfaces.fish index d9805359a..bb3dbbd98 100644 --- a/share/functions/__fish_print_interfaces.fish +++ b/share/functions/__fish_print_interfaces.fish @@ -4,7 +4,7 @@ function __fish_print_interfaces --description "Print a list of known network in for i in * echo $i end - else - netstat -i -n -a | awk 'NR>2'|awk '{print $1}' + else # OSX/BSD + command ifconfig -l | tr ' ' '\n' end end