#!/bin/bash## Quick shell script to be initiated by the "wireless" button on laptop## Will be run with command "gksudo SCRIPTNAME"########################## Defining Variables ##########################statusfile=/etc/wireless-statusversion=TogglEd-0.3########################## Defining Functions ##########################function EnableWireless { chmod 777 /proc/acpi/acer/wireless ##gksudo/sudo not necessarily transportable over all systems echo "enabled : 1" > /proc/acpi/acer/wireless}function DisableWireless { chmod 777 /proc/acpi/acer/wireless ##gksudo/sudo not necessarily transportable over all systems echo "enabled : 0" > /proc/acpi/acer/wireless}function UpdateStatusON { echo "Wireless ON" > "$statusfile" zenity --notification --title="$version" --text="Wireless has been enabled"}function UpdateStatusOFF { echo "Wireless OFF" > "$statusfile" zenity --notification --title="$version" --text="Wireless has been disabled"}function Error { zenity --error --title="$version" --text="Something is wrong with $statusfile"}############ Main #############if no statusfile, turn on wirelessif [ ! -e $statusfile ] ; then zenity --error --title="$version" --text="Something is wrong with $statusfile" EnableWireless UpdateStatusOnfi#check status and act accordinglyread line < "$statusfile"if [ "$line" == "Wireless ON" ] ; then DisableWireless UpdateStatusOFFelif [ "$(cat $statusfile)" == "Wireless OFF" ] ; then EnableWireless UpdateStatusONelse Errorfi