#!/bin/sh # gain superuser rights. if [ `id -u` != 0 ] ; then exec sudo gainroot <<EOF exec sh $0 $* EOF exit $? fi # put your code below ifconfig wlan0 down; iwconfig wlan0 mode Monitor; ifconfig wlan0 up; exit;