From csh script, how to know if logged in as root?

In Solaris or Linux, whenever I’m logged in (at the console), as root, then, I see the # sign.

But if I were running a csh script, how do I know if the user running that script is logged in as root?

Run the command whoami or the command id -u

In a script you can check whether you are root quite simple:

if  $UID -ne 0 ]; then
... # I was not invoked by root
else
... # I was invoked by root
fi