Deleting local git branches with a missing remote branch

I have about 100 git repositories at $job, and of those, about 90% of them have branches that were created locally that were set as tracking branches, but never pushed to a remote. It makes looking at the output of git branch very annoying, so I wrote the script below to clean up those branches.