#!/bin/sh # # Change directory and run script. # # This script changes to the dirname of $1 and then executes the basename of $1 # # # Try to prevent more than one running at a time # in case the user clicks too many times being impatient # OS=`uname -r | sed -e 's/\..*//'` if [ $OS -eq 4 ] then PSOPTS="-ax" else PSOPTS="-ef" fi PSCOUNT=`ps $PSOPTS | grep -c "$1"` if [ $PSCOUNT -gt 2 ] then echo "This application is already in progress." exit 1 fi cd `dirname $1` exec `basename $1`