All pastes #58711 Raw Edit

Anonymous

public shellscript v1 · immutable
#58711 ·published 2006-05-24 21:17 UTC
rendered paste body
#!/bin/bashAUTOSWITCH_STATUS=$AUTOSWITCH_STATUSfunction autoswitch_on () {  if [[ $AUTOSWITCH_STATUS != "ON" ]] ; then     AUTOSWITCH_STATUS="ON"     export AUTOSWITCH_STATUS    echo "Turning autoswitcher on."    source /alexa/projects/bin/autoswitcher_init.sh  fi}function autoswitch_off() {   AUTOSWITCH_STATUS="OFF"  echo "Turning autoswitcher off."  source /alexa/projects/bin/autoswitcher_stop.sh}case $1 in"help" )  echo $0  echo "--------------------------------------------------"  echo "HELP:"  echo "This script takes one argument which can take the form of:"  echo "autoswitcher [off, on, status, help]"  echo "         If no argument is provided, it will attempt to toggle the current"  echo "         status.  The environment variable AUTOSWITCH_STATUS is used for this."   echo ""  echo "status   Output whether the autoswitcher is on or off."  echo ""  echo "help     This message."  echo ""  ;;"status" )  if [[ $AUTOSWITCH_STATUS == "ON" ]] ; then    echo "on"  else    echo "off"  fi  ;;"off" )  autoswitch_off  ;;"on" )  autoswitch_on    ;;"" )  echo "toggle"  if [[ $AUTOSWITCH_STATUS != "ON" ]] ; then    autoswitch_on  else    autoswitch_off  fi  ;;esac