Skip to content

Instantly share code, notes, and snippets.

@oscarkramer
Created March 30, 2023 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarkramer/7670ee59a5fac0e72e4f281c318e8180 to your computer and use it in GitHub Desktop.
Save oscarkramer/7670ee59a5fac0e72e4f281c318e8180 to your computer and use it in GitHub Desktop.
Bash get script directory
#!/bin/bash
pushd $(dirname ${BASH_SOURCE[0]}) > /dev/null
SCRIPT_DIR=`pwd -P`
popd >/dev/null
echo "Script directory is $SCRIPT_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment