This is what I've started using on Mojave 10.14.3 which seems to work
#!/bin/sh grabConsoleUserAndHome(){ # don't assume the home folder is
equal to the user's name CURRENT_USER="" CURRENT_USER=$(stat -f %Su
"/dev/console") HOME=$(dscl . read /Users/...