function up() {

# Created at: 2012/06/19 10:37:26
# Go up directory tree X number of directories
# source:
# see explanation at link above, worth!
# I found this here:
# put this function to your ~/.bashrc
# binding this function to key see below

    COUNTER="[email protected]";
	# default $COUNTER to 1 if it isn't already set
	if [[ -z $COUNTER ]]; then
	# make sure $COUNTER is a number
	if [ $COUNTER -eq $COUNTER 2> /dev/null ]; then
		nwd=`pwd` # Set new working directory (nwd) to current directory
		# Loop $nwd up directory tree one at a time
		until [[ $COUNTER -lt 1 ]]; do
			nwd=`dirname $nwd`
			let COUNTER-=1
		cd $nwd # change directories to the new working directory
		# print usage and return error
		echo "usage: up [NUMBER]"
		return 1