From 7bddde2dc7927fd415845b52ba691010462ecdb9 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sun, 12 Apr 2020 23:24:41 +0200 Subject: [PATCH] Update netctl.sh help --- .scripts/netctl.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.scripts/netctl.sh b/.scripts/netctl.sh index fe23f8c..81a8081 100755 --- a/.scripts/netctl.sh +++ b/.scripts/netctl.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Control the network interfaces +# Depends: iproute2, netctl + WIRELESS="wlan0" ETHERNET="eth0" PROFILE="eth0-dhcp" @@ -11,19 +14,21 @@ help() { cat << EOF ${B}NAME${N} - netctl.sh - network manager + netctl.sh - control the network interfaces ${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}-e${N} [${U}ARG${N}] + ${B}-h${N} Display usage message and exit. + + ${B}-e${N} [${U}STATE${N}] Perform action on ethernet. - ${B}-w${N} [${U}ARG${N}] + ${B}-w${N} [${U}STATE${N}] Perform action on wireless. -${B}ARGS${N} +${B}COMMANDS${N} 1, on Enable selected option. @@ -35,13 +40,14 @@ EOF # Exit if no option is provided [ "$#" -eq 0 ] && help && exit 1 -# Option handling SCRIPT="$(basename "$0")" + +# Option handling while getopts ':h?e:w:' opt; do case $opt in h) help - exit 1 + exit 0 ;; e) dev="ethernet" @@ -89,7 +95,8 @@ case "$1" in [ "$dev" = "ethernet" ] && ethernet 0 || wireless 0 ;; *) - help + echo "$SCRIPT: invalid command '$1'" + echo "Try '$SCRIPT -h' for more information." exit 1 ;; esac