Almost always I write a bash script and save it in the place where I want it to operate (its working directory). That's not what bash thinks should happen. By default, bash operates in YOUR working directory.
This means that by default if you write some cool path/to/tool/script.sh
it will operate in your folder, rather than the folder of the script.
Fortunately it's a simple one line fix:
cd "$(dirname "$0")"