Skip to content

Instantly share code, notes, and snippets.

@runmaxde
Created October 19, 2023 19:58
Show Gist options
  • Save runmaxde/4b251f729d3338207d19a21f64ed8f48 to your computer and use it in GitHub Desktop.
Save runmaxde/4b251f729d3338207d19a21f64ed8f48 to your computer and use it in GitHub Desktop.
Bash: Move to the script directory to be able to execute the script from anywhere
# -------------------------------------------------------------------------------------------------
# -- Move to the script directory (to be able to execute the script from anywhere)
# -------------------------------------------------------------------------------------------------
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# do your stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment