Skip to content

Instantly share code, notes, and snippets.

@jtr109
Created December 5, 2018 12:50
Show Gist options
  • Save jtr109/131f73e3ef60f78ed3954b891f77a964 to your computer and use it in GitHub Desktop.
Save jtr109/131f73e3ef60f78ed3954b891f77a964 to your computer and use it in GitHub Desktop.
get path of the executed bash file
#!/bin/bash
# reference: https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
currentDir=$(
cd $(dirname "$0")
pwd
)
echo -n "current "
pwd
echo script $currentDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment