Browse Source

Update netctl.sh help

master
Riyyi 5 years ago
parent
commit
7bddde2dc7
  1. 23
      .scripts/netctl.sh

23
.scripts/netctl.sh

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
# Control the network interfaces
# Depends: iproute2, netctl
WIRELESS="wlan0" WIRELESS="wlan0"
ETHERNET="eth0" ETHERNET="eth0"
PROFILE="eth0-dhcp" PROFILE="eth0-dhcp"
@ -11,19 +14,21 @@ help() {
cat << EOF cat << EOF
${B}NAME${N} ${B}NAME${N}
netctl.sh - network manager netctl.sh - control the network interfaces
${B}SYNOPSIS${N} ${B}SYNOPSIS${N}
${B}netctl.sh${N} [${U}OPTION${N}] [${U}ARG${N}] ${B}netctl.sh${N} [${U}OPTION${N}] [${U}COMMAND${N}]
${B}OPTIONS${N} ${B}OPTIONS${N}
${B}-e${N} [${U}ARG${N}] ${B}-h${N} Display usage message and exit.
${B}-e${N} [${U}STATE${N}]
Perform action on ethernet. Perform action on ethernet.
${B}-w${N} [${U}ARG${N}] ${B}-w${N} [${U}STATE${N}]
Perform action on wireless. Perform action on wireless.
${B}ARGS${N} ${B}COMMANDS${N}
1, on 1, on
Enable selected option. Enable selected option.
@ -35,13 +40,14 @@ EOF
# Exit if no option is provided # Exit if no option is provided
[ "$#" -eq 0 ] && help && exit 1 [ "$#" -eq 0 ] && help && exit 1
# Option handling
SCRIPT="$(basename "$0")" SCRIPT="$(basename "$0")"
# Option handling
while getopts ':h?e:w:' opt; do while getopts ':h?e:w:' opt; do
case $opt in case $opt in
h) h)
help help
exit 1 exit 0
;; ;;
e) e)
dev="ethernet" dev="ethernet"
@ -89,7 +95,8 @@ case "$1" in
[ "$dev" = "ethernet" ] && ethernet 0 || wireless 0 [ "$dev" = "ethernet" ] && ethernet 0 || wireless 0
;; ;;
*) *)
help echo "$SCRIPT: invalid command '$1'"
echo "Try '$SCRIPT -h' for more information."
exit 1 exit 1
;; ;;
esac esac

Loading…
Cancel
Save