#!/bin/sh cd "`dirname "$0"`" result=${PWD##*/} # to assign to a variable result=${result:-/} # to correct for the case where PWD=/ cd .. exec ./dragonruby ${result}