cd to bash script directory
First, we store the path where we were before using
pwd command. Then we go to the script directory and do work there assuming that we can do file operations in relation to the script folder. Then we return it back.
pwd) cd "$(dirname "$0")" # now you are in your script dir # do your staff here cd $cwdcwd=$(
This allows run script that use related file path from any current path.