Skip to content

Instantly share code, notes, and snippets.

@mjj2000
Last active May 8, 2023 15:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mjj2000/c84cd777e6e3fec9094d to your computer and use it in GitHub Desktop.
Save mjj2000/c84cd777e6e3fec9094d to your computer and use it in GitHub Desktop.
Shell script to get full folder path of itself
if [ -L $0 ] ; then
BASEDIR=$(cd "$(dirname "$(readlink $0)")"; pwd -P) # for symbolic link
else
BASEDIR=$(cd "$(dirname "$0")"; pwd -P) # for normal file
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment