Skip to content

Instantly share code, notes, and snippets.

@robinbb
Last active May 25, 2020 19:42
Show Gist options
  • Save robinbb/856607e1f436cd5c5d4f804abfa8e663 to your computer and use it in GitHub Desktop.
Save robinbb/856607e1f436cd5c5d4f804abfa8e663 to your computer and use it in GitHub Desktop.
Get directory of Bash script
#! /usr/bin/env bash
MY_DIR="$(CDPATH='' cd -- "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment