fish-shell/share/functions/__fish_print_interfaces.fish

13 lines
440 B
Fish
Raw Normal View History

function __fish_print_interfaces --description "Print a list of known network interfaces"
if test -d /sys/class/net
2023-04-25 19:13:57 +00:00
path basename /sys/class/net/*
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