I am using the following executable to download a zip from the web, extract it and then delete the zip.
#!/usr/bin/env bash
echo "Downloading project resources from Storage..."
filename="outfile.zip"
if curl --silent -o "${PWD}/${filename}" -L "https://mylink.com"; then
    unzip "${filename}"
    if [[ -f "${PWD}/${filename}" ]]; then
        echo "Removing the file.."
        rm -f "${PWD}/${filename}"
    fi
else
    echo "Something went wrong"
fi
echo "Done!"
However, PWD does not seem to work as the zip is downloaded in the home directory of my Mac and the files are extracted there as well. I want to the zip to download and extract in the same folder of the executable file, no matter where it is. 
What am I doing wrong here?
