If I create the script /root/bin/whoami.sh containing:
/root/bin/whoami.sh
#!/bin/bash whoami
and this script is called by a user with a properly
who am i | awk '{print $1}' didn't work for me but who|awk '{print $1}' will serve the job
who am i | awk '{print $1}'
who|awk '{print $1}'