Simple BASH script not working?

So I need a script that does the following:

If a certain user is logged in

Run `command`

Else

Echo �incorrect user�

This is my first stab...which doesn't work:

#!/bin/bash

X="user=`ls -l /dev/console | cut -d " " -f 4`"
Y="foobar"

echo $X
echo $Y

if [ $X==$Y ]; then
   echo "no"
else
  `echo yes - run something!`
fi

It always echos yes, as though $X == $Y. Sigh. New to this - unsure of what to do.

Thanks,
double

How would you expect the script to run in the absence of a logged in user? Is this script in crontab? Is it a daemon?

What exactly are you trying to do -- not how you've tried to do it.

Jim,

Thanks for the reply. I did a poor job of describing what I was trying to do.

If a certain user is logged in...then I want to run a command. Otherwise, no command.

#!/bin/ksh

iam="${USER}"
goodUSER='iAmGood'

echo "iam->[${iam}]"
echo "goodUser->[${goodUser}]"

if [ "${iam}" = "${goodUser}" ]; then
   echo 'yes - run something!'
else
   echo 'no'
fi

Why just not put the command on the user's profile, so it would run when the user logs in?