I ran a debug task and it showed that my fog.ad file had multiple $‘\r’ command not found errors which, after a bit of googling, turned out to be due to windows line returns being present in the file. I ran the command sed -i ‘s/\r$//’ fog.ad and everything is now running fine.
Thanks