#!/bin/sh
#
#  volume.sh, a bash script by duus made on Mon Jun 25 21:44:21 EDT 2007 
#  lives in: ~/Documents/Software/unixscripts//system/volume.sh 
#  run binedit volume to edit.  see binedit help for more information
#
_OLDVOLFILE=~/.oldVolume
if [ "$1" = "" -o "$1" = "g" -o "$1" = "get" ]
	then
	_tmp=`osascript -e 'get output volume of (get volume settings)'`
	_currvol=`expr ${_tmp} / 10`
	echo -n ${_currvol}
	elif [ "$1" = "h" -o "$1" = "help" -o "$1" = "v" -o "$1" = "version" ]
		then
		echo "volume control"
		echo " no arg or 'get' echoes output volume"
		echo " number goes to new number (not working properly)"
		echo " <b>ack goes to last saved number"
	elif [ "$1" = "b" -o "$1" = "back"  ]
		then
		echo "Not properly implemented"
		_newvol=`cat ~/.oldVolume`
		echo " new volume is: |${_newvol}|"
		volume ${_newvol}
	else
	rm ${_OLDVOLFILE}
	volume get > ${_OLDVOLFILE}
	#echo -n oldvolume:
	#cat ${_OLDVOLFILE}
	echo "set system volume to $*"
	osascript -e "set volume $*"
fi


