Detecting whether a session is locally or remotely logged in

Tony Langdon <[email protected]>
Newsgroups gmane.org.user-groups.mlug.main
Message-ID <[email protected]>
Is there an easy way to determine if a shell session is local or remote to 
the system?  I need to determine this for certain applications 
(specifically, GPG key generation), and want to idiot proof my scripts.

Local can include in a local xterm as well as console.

Remote includes remote xterms and SSH sessions (mostly SSH).

Any thoughts?

FYI, the box is a fairly standard FC4 box.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.