All pastes #434745 Raw Edit

Someone

public shellscript v1 · immutable
·published 2007-04-11 16:02 UTC
rendered paste body
#!/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 [ -z $statusfile ] ; then#	zenity --error --title="$version" --text="Something is wrong with $statusfile"#	EnableWireless#	UpdateStatusOnfi#check status and act accordinglyif [ $(cat $statusfile) == "Wireless ON" ] ; then	DisableWireless	UpdateStatusOFFelif [ $(cat $statusfile) == "Wireless OFF" ] ; then	EnableWireless	UpdateStatusONelse Errorfi