#!/bin/sh default_dev='wlan0=funston' die() { printf 'Error: %s\n' "$*" >&2; exit 1; } with_pwd_path() { local PATH="$PATH":. "$@" } [ $(id -u) = 0 ] || die "you are not root." restart=$(with_pwd_path which restart-linux-device) || die "command 'restart-linux-device' is not available." dev=${1:-$default_dev} rawdev=${dev%=*} [ "$VERBOSE" ] && set -x $restart $rawdev ifdown --force $rawdev # It's not clear to me why this is necessary, but it is. ifup $dev