Ensure relative paths work in a bash script
To ensure relative paths work in a bash script you can set the working directory to the directory the script is in.
Setting the directory
To change the directory to the script location can you cd
(change directory) to the value of dirname $0
.
cd $(dirname $0)
Why this is important
This means that if the script is called from a different path the relative paths inside the script will still work.