#!/bin/sh DEV=`ls -1 /sys/class/net | grep wlan` if [[ $DEV == "" ]]; then DEV=`ls -1 /sys/class/net | grep wlp` fi setup_wifi() { sudo wpa_supplicant -i $DEV -c ~/.net_profiles/$1.conf &>/tmp/wpa_supplicant.log & sudo /etc/init.d/dhcpcd start sleep 30 sudo rc-config start ntp-client } if [ ! -f ~/.net_profiles/$1.conf ]; then echo "no such profile" exit fi setup_wifi $1