Skip to content

Instantly share code, notes, and snippets.

@khalidx
Created October 18, 2020 04:06
Show Gist options
  • Save khalidx/733ab914adcd9080ae0d7f5e99b3a572 to your computer and use it in GitHub Desktop.
Save khalidx/733ab914adcd9080ae0d7f5e99b3a572 to your computer and use it in GitHub Desktop.
For cd'ing into the same directory as the script file, instead of running at cwd by default.
# https://stackoverflow.com/questions/3349105/how-to-set-current-working-directory-to-the-directory-of-the-script-in-bash
cd "${0%/*}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment