Skip to content

Instantly share code, notes, and snippets.

@andreafioraldi
Created December 26, 2017 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreafioraldi/2102d2a8831d1ad423ed40526a28e8bd to your computer and use it in GitHub Desktop.
Save andreafioraldi/2102d2a8831d1ad423ed40526a28e8bd to your computer and use it in GitHub Desktop.
Get script directory in Bash script
#!/bin/bash
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
echo "The script is in the directory $SCRIPTPATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment