diff --git a/.bin/network b/.bin/network index 39b2268..e384ea6 100755 --- a/.bin/network +++ b/.bin/network @@ -1,22 +1,35 @@ #!/bin/sh +### DEFAULTS + + +### ARGUMENTS for arg in "$@" do case "$arg" in - status) status=1 ;; + start) _start=1 ;; + stop) _stop=1 ;; + status) _status=1 ;; + route) _route=1 ;; + wifi) _wifi=1 ;; + hotspot) _hotspot=1 ;; + adhoc) _adhoc=1 ;; esac shift done +### FUNCTIONS _ifconfig() { [ -z "$_ifdata" ] \ && _ifdata="$(ifconfig)" echo "$_ifdata" } +### DATA _interfaces="$(_ifconfig | egrep "^[a-z]" | cut -d: -f1 | egrep -v "lo0|enc0|pflog0" | xargs)" -if [ -n "$status" ] +### MAIN PROGRAM +if [ -n "$_status" ] then for _dev in $_interfaces do