If it is of any use, here is a bash utility function that I use to get the script dir, just include it in the top of your bash file.

## Works for scripts executed like this:
#       ./doscript.sh
#       /opt/scripts/doscript.sh
#       ./mydir/scripts/anotherdir/doscript.sh
function script_dir {
        CUR_WORKING_DIR=`pwd`
        SCRIPT_EXEC_CMD=$0
        SCRIPT_EXEC_DIR=`dirname $0`
        cd $SCRIPT_EXEC_DIR
        SCRIPT_DIR=`pwd`
        ## go back to working dir
        cd $CUR_WORKING_DIR
        echo "$SCRIPT_DIR"
}



On Jun 12, 2009, at 1:53 PM, Mike Schrag wrote:

When I kick off a build, it's downloading my project from SVN as expected, and then executing the shell command: ./setupWorkspace.sh ${WORKSPACE} 54
don't execute ./, execute with the full path to setupWorkspace.sh ... it's using "dirname $0" to get its folder, which is "." in your case.

ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to