conn

A script repository to manage connections in Linux.
git clone git://r-36.net/conn
Log | Files | Refs | LICENSE

commit 880e428a9e9945969dfcb4011d494341d9c31d17
parent bcf27847d7146a104d12381e55261d5d0609b342
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 23 Feb 2011 09:52:39 +0100

Shorting the if expressions in bash.

Diffstat:
etc/conn/eth/run.sh | 8++------
etc/conn/wifi/run.sh | 8++------
etc/conn/wifi/wlan0-action.sh | 4+---
etc/conn/wwan/run.sh | 13+++----------
4 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/etc/conn/eth/run.sh b/etc/conn/eth/run.sh @@ -2,12 +2,8 @@ . ../common.sh -if [ "$2" == "" ]; -then - interface="eth0" -else - interface=$2 -fi +interfce=$2 +[ "$2" == "" ] && interface="eth0" case "$1" in -s) diff --git a/etc/conn/wifi/run.sh b/etc/conn/wifi/run.sh @@ -2,12 +2,8 @@ . ../common.sh -if [ "$2" == "" ]; -then - interface="wlan0" -else - interface=$2 -fi +interface=$2 +[ "$2" == "" ] && interface="wlan0" case "$1" in -s) diff --git a/etc/conn/wifi/wlan0-action.sh b/etc/conn/wifi/wlan0-action.sh @@ -6,10 +6,8 @@ interface="$1" action="$2" ssid=`getssid $interface` -if [ "$LOGGING" == "1" ]; -then +[ $LOGGING -eq 1 ] && \ logger -t "$interface-action" "Got request for $interface $ssid $action." -fi getscript() { cat networks.tbl \ diff --git a/etc/conn/wwan/run.sh b/etc/conn/wwan/run.sh @@ -2,19 +2,12 @@ . ../common.sh -if [ "$2" == "" ]; -then - interface="wwan0" -else - interface="$2" -fi +inteface=$2 +[ "$2" == "" ] && interface="wwan0" iffile="${WWANDIR}/${interface}-run.sh" -if [ ! -e $iffile ]; -then - exit 1 -fi +[ ! -e $iffile ] && exit 1 $iffile $1