#!/bin/bash # That's __FILE__ in BASH :) # From: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink MCLDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$MCLDIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )"/.. && pwd )" # Actually run script cd $PROJECT_ROOT && bundle exec ruby elch_scan.rb "$@"