This is inside a Here Document, so this is all piped into a file. ``sudo`` resets all unknown environment variables, which is why we need to pipe it into a file, and run that file using sudo.