I just discovered that "who am i" prints nothing if stdin is a ptty. It gets the name from ttyname, then searches /etc/utmp for a line matching the ptty. Since no one is logged in on a ptty it fails. This was observed under Pyramid OS-X which pretends to be both BSD and SysV.