Skip to content

Instantly share code, notes, and snippets.

@instantiator
Created June 1, 2026 07:42
Show Gist options
  • Select an option

  • Save instantiator/b05f3c28c0e97b66bb9d63e7a5e4e4dd to your computer and use it in GitHub Desktop.

Select an option

Save instantiator/b05f3c28c0e97b66bb9d63e7a5e4e4dd to your computer and use it in GitHub Desktop.
Obtain SCRIPT_PATH in shell scripts - useful for scripts that work on files in fixed relative directories
# obtain the script path - taking into account any symlinks
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment