Created
December 17, 2024 07:30
-
-
Save jarryDk/89a7ae464acb4d321217eed4c7cab3ad to your computer and use it in GitHub Desktop.
Get the directory where a Bash script is located from within the script itself
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Get the directory where a Bash script is located from within the script itself | |
# | |
# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script#246128 | |
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment