#!/bin/bash # # cakeshell 0.1 - (c)2010 nerdnotes.org # # configuration REL_CAKE_PATH=cake/console/cake function usage { echo "cakeshell 0.1 - (c)2010 nerdnotes.org" echo echo "This wrapper script is built in order to ease running cake shells." echo echo "Usage:" echo "The script should be located somewhere your cake directory structure." echo "Make sure you configure the relative path of the cake script from the" echo "directory this script lives in (REL_CAKE_PATH)." echo echo "For each of the shells you want to be available, create a symlink to" echo "$0 with the name of the cake shell you want to execute" echo echo "Example*" echo "*using some real world paths here" echo echo "To simplify the following cake shell call:" echo echo "./cake/console/cake bake" echo echo "You'll need to do this once:" echo echo "cd ~/bin" echo "ln -s ../public_html/cakesite/cakeshell bake" echo echo "If ~/bin is in your PATH, you can simply run the bake script from anywhere" echo } # find out what the directory name of the script is. # this allows symlinking from ~/bin if [ ! -L $0 ] then echo "Error: script should be symlinked" usage exit 1 fi # get all the required info that we need to run! ABSOLUTE_PATH=`readlink -f $0` DIR=`dirname $ABSOLUTE_PATH` CAKE=$DIR/$REL_CAKE_PATH SHELL=`basename $0` ARGUMENTS="$@" echo Executing \"$CAKE $SHELL $ARGUMENTS\"... >&2 # change to base directory cd `dirname $CAKE`/../../ # finally execute the shell $CAKE $SHELL $ARGUMENTS exit 0