fish-shell/share/functions/__fish_print_interfaces.fish

14 lines
498 B
Fish
Raw Normal View History

function __fish_print_interfaces --description "Print a list of known network interfaces"
if test -d /sys/class/net
2017-01-18 17:50:43 +00:00
set -l interfaces /sys/class/net/*
string replace /sys/class/net/ '' $interfaces
else # OSX/BSD
2017-12-11 14:16:52 +00:00
set -l os (uname)
if string match -e -q BSD -- $os
2017-12-11 14:16:52 +00:00
command ifconfig | string match -e -r '^[a-z]' | string replace -r ':.*' '' | string split ' '
else
command ifconfig -l | string split ' '
end
end
end