mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 11:37:10 +08:00
14 lines
500 B
Fish
14 lines
500 B
Fish
function __fish_print_interfaces --description "Print a list of known network interfaces"
|
|
if test -d /sys/class/net
|
|
set -l interfaces /sys/class/net/*
|
|
string replace /sys/class/net/ '' $interfaces
|
|
else # OSX/BSD
|
|
set -l os (uname)
|
|
if string match -e -q "BSD" -- $os
|
|
command ifconfig | string match -e -r '^[a-z]' | string replace -r ':.*' '' | string split ' '
|
|
else
|
|
command ifconfig -l | string split ' '
|
|
end
|
|
end
|
|
end
|