fish-shell/share/functions/__fish_print_interfaces.fish

13 lines
440 B
Fish
Raw Permalink Normal View History

function __fish_print_interfaces --description "Print a list of known network interfaces"
if test -d /sys/class/net
2023-04-26 03:13:57 +08:00
path basename /sys/class/net/*
else # OSX/BSD
2017-12-11 22:16:52 +08:00
set -l os (uname)
if string match -e -q BSD -- $os
2017-12-11 22:16:52 +08:00
command ifconfig | string match -e -r '^[a-z]' | string replace -r ':.*' '' | string split ' '
else
command ifconfig -l | string split ' '
end
end
end