Automatically switch working directory in bash script