mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
__fish_print_{addresses,interaces}: Better OSX/BSD
This commit is contained in:
parent
f7e8f8031d
commit
b34127e346
2 changed files with 6 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue