When run by itself, whoami looks like this:
That should be sufficient to give you the clue on how to implement the test you seek:
if [ $(whoami) = "sbovisjb1" ]
execute the code, we're the right user
echo "You must be user 'joe' to run this script."
You can modify this to match the user or set of users you want to allow, or you can negate the logic to screen out bad userIDs immediately, like this:
if [ $(whoami) = "root" ]
echo "You cannot run this script as root."
original source: http://www.askdavetaylor.com/how_can...k_user_id.html