Skip to content

Instantly share code, notes, and snippets.

@ntrrgc
Created August 18, 2015 18:44
Show Gist options
  • Save ntrrgc/80eaf8957aa965be55ee to your computer and use it in GitHub Desktop.
Save ntrrgc/80eaf8957aa965be55ee to your computer and use it in GitHub Desktop.
Get the directory where the script resides
# http://stackoverflow.com/a/22614738/1777162
SCRIPT=$( readlink -m $( type -p "$0" )) # Full path to script
BASE_DIR=`dirname "${SCRIPT}"` # Directory script is run in
NAME=`basename "${SCRIPT}"` # Actual name of script even if linked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment