[Prev][Next][Index][Thread][Search]

Some useful bash customizations



Hi--

In a message yesterday I gave a few tips on getting aural feedback
from a bare bones UNIX system ie just a shell with no emacspeak or any
other speech or access utility running.

I'll attach a few of the functions from   my bash environment that are
generally useful--
edit, customize, clone to your hearts content.
These are just a taste of the kind of things you can do to
survive when you are debugging or building an access utility.

To keep things sane I usually have these functions in a file called
.bash_functions which gets loaded by my .bash_profile
#Locate processes:
#Usage: ps_spot process name
#Example: ps_spot emacs

function ps_spot () { 
echo  `ps auxww | grep $1 | grep -v grep`
}

#Nuke processes
#Usage: ps_slay process name
#Example: ps_slay emacs

function ps_slay () {
   killing=`ps auxww | grep $1 | grep -v grep |  cut -c10-16`
   echo "Killing $killing"
   kill -9 $killing 
}

#	readln prompt default
#
function readln () {
	if [ "$DEFAULT" = "-d" ]; then
		echo "$1"
		ans=$2
	else
		echo -n "$1"
		IFS='@' read ans </dev/tty || exit 1
		[ -z "$ans" ] && ans=$2
	fi
}


#dectalk related calls
#Speak a string
#Usage s string

function s () {
echo "[:punc all] $* [_.] "  > /dev/ttyS0
}

#Shut up
#Usage q

function q () {
echo "" >/dev/ttyS0
}

#cdl --auditory cue indicates success
#Usage cdl directory
#If it fails you hear an auditory cue.

function cdl () {
cd $* && /usr/local/bin/play double_sine_beep.au
}

-- 
Best Regards,
--raman

      Adobe Systems                 Tel: 1 (408) 536 3945   (W14-129)
      Advanced Technology Group     Fax: 1 (408) 537 4042 
      (W14 129) 345 Park Avenue     Email: raman@xxxxxxxxxxx 
      San Jose , CA 95110 -2704     Email:  raman@xxxxxxxxxxx
      http://labrador.corp.adobe.com/~raman/raman.html (Adobe  Internal)
      http://www.cs.cornell.edu/Info/People/raman/raman.html  (Cornell)
-----------------------------------------------------------------------
    Disclaimer: The opinions expressed are my own and in no way should be taken
as representative of my employer, Adobe Systems Inc.
____________________________________________________________