Browse Source

Prettification

Removed extra words people can use for arguments, just doesn't look nice

streamlines case statements

fixed apply function indentation (a la request of Mike Stone)
master
student 1 year ago
parent
commit
12f502a83e
1 changed files with 11 additions and 12 deletions
  1. 11
    12
      nmcli-basic.sh

+ 11
- 12
nmcli-basic.sh View File

@@ -15,9 +15,6 @@ function usage() {

Syntax:
./nmcli-basic.sh [dynamic|static|usage]

The script will also take automatic, auto, and dhcp
as valid inputs for dynamic addressing.
"
}

@@ -86,9 +83,9 @@ function apply() {
#Applying the changes

echo "Applying changes..."
nmcli con down ${IntID} > /dev/null
nmcli con up ${IntID} > /dev/null
echo "Done!"
nmcli con down ${IntID} > /dev/null
nmcli con up ${IntID} > /dev/null
echo "Done!"
}

function conshow() {
@@ -142,11 +139,12 @@ function validip {

function getchoice() {
read -p "Static or DHCP? " CHOICE
CHOICE=`echo ${CHOICE}|tr '[:upper:]' '[:lower:]'`
case ${CHOICE} in
[dD]ynamic | [aA]uto | [aA]utomatic | [dD][hH][cC][pP])
dhcp)
setdynamic
;;
[sS]tatic | [mM]anual)
static)
setstatic 1
;;
*)
@@ -159,15 +157,16 @@ function getchoice() {
esac
}

case "$1" in
[dD]ynamic | [aA]uto | [aA]utomatic | [dD][hH][cC][pP])
ArgVar=`echo $1|tr '[:upper:]' '[:lower:]'`
case "${ArgVar}" in
dhcp)
setdynamic
;;
[sS]tatic | [mM]anual)
static)
setstatic 1
;;

[uU]sage)
usage)
usage
;;
"")

Loading…
Cancel
Save