-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnmcli-cli-slave-list
More file actions
executable file
·51 lines (40 loc) · 893 Bytes
/
Copy pathnmcli-cli-slave-list
File metadata and controls
executable file
·51 lines (40 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#
# nmcli-cli-slave-list
#
# Copyright (c) 2019-2026 Jun Futagawa (jfut)
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
VERSION="1.2.1"
usage() {
local COMMAND_NAME
COMMAND_NAME="$(basename "${0}")"
cat << _EOF_
${COMMAND_NAME} ${VERSION}
Usage:
${COMMAND_NAME} IF_NAME
Examples:
${COMMAND_NAME} bond1
${COMMAND_NAME} vlan.100
${COMMAND_NAME} br1
_EOF_
}
slave_list() {
local IF_NAME=${1:-}
local i
# Find lower interfaces
TARGET="/sys/class/net/${IF_NAME}/"
if [[ -e "${TARGET}" ]]; then
for i in "${TARGET}"/lower_*; do
[[ -e "${i}" ]] || continue
echo "${i##*/lower_}"
done
fi
}
# Main
main() {
[[ $# -lt 1 ]] && usage && exit 1
slave_list "${@}"
}
[[ "${BASH_SOURCE[0]}" == "$0" ]] && main "$@"