#!/bin/sh # You would think you could count on whoami being present on all # Unix systems, but apparently that isn't always the case. # For systems that do not have a whoami command, # this script should do the same thing. # Note: This script should never be placed in any of the # target directories, such as /usr/local/bin, because # that would result in an infinite loop. RESULT=`which whoami` case "$RESULT" in /usr/local/bin/whoami) WHOAMIPATH=$RESULT echo `$WHOAMIPATH` ;; /usr/bin/whoami) WHOAMIPATH=$RESULT echo `$WHOAMIPATH` ;; /bin/whoami) WHOAMIPATH=$RESULT echo `$WHOAMIPATH` ;; *) USERID=`echo $HOME | sed -e 's%/.*/%%'` echo $USERID ;; esac