Someone suggested privately that I try exporting HOSTNAME, and that was indeed it. I had no idea the bash environment variables weren't exported by default, guess you learn something every day. It confused me because I exported everything else in my .bashrc.