Saturday, January 4, 2020

radio

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#
# radio -- using rfkill, quek style
# (designed for use with antiX-19)
#
# By E. Katzenjammer, 24 Dec 2019
#
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR FRIENDLY USE
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
_path=$0
_name="${_path##*/}"
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
freeEurope() {

  rfkill unblock 0

}
#----------------------------------------------------------------------
freeWorld() {

  rfkill unblock all

}
#----------------------------------------------------------------------
#----------------------------------------------------------------------
deadAirSpace() {

  rfkill block all

}
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
if [ $BASH_SOURCE = "$_path" ] ; then  # script called directly

  if [[ $# -eq 0 ]] ; then # unblock default

    freeEurope
    echo 10-4
    exit 0
  fi

  if [[ "$1" = "off" ]] ; then # block all radio

    deadAirSpace
    echo All quiet on the antiX front...
    exit 0
  fi

  echo Ahem: $_name "(off)" >&2
  exit 1
 
fi
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF script — 200104.1602
#//////////////////////////////////////////////////////////////////////

bash script template

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#
# scriptName -- description
#
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR FRIENDLY USE
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
_path=$0
_name="${_path##*/}"
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#fxn() {

  # function

#}
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------

if [ $BASH_SOURCE = "$_path" ] ; then  # script called directly

  # this is what happens when you call the script directly

fi

#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF script — 190315.1547
#//////////////////////////////////////////////////////////////////////