[olug] am I at the console?
Phil Brutsche
phil at brutsche.us
Sat Mar 25 00:13:25 UTC 2006
Theodore Katseres wrote:
> On 3/24/06, thelarsons3 at cox.net <thelarsons3 at cox.net> wrote:
>> Hello,
>>
>> I want a shell script to check if it's being run at the console, so
>> it can act differently than it would in a virtual/remote terminal.
>> Is this possible? A portable (cross-Unix) solution would be great,
>> but I'll take anything.
>
> tty
>
> Capture the output and check for /dev/pty
I think you'll find that virtually all Linux systems will say "/dev/pts"
for a telnet/ssh session these days. The rare exception will be the
cases where
a) It's an ooooold installation and
b) Someone upgraded it to a 2.2.x or newer kernel at one point and
c) Neglected to upgrade to glibc v2.1 or newer
> if that's true then its a remote console
>
> Works for Linux and AIX
--
Phil Brutsche
phil at brutsche.us
More information about the OLUG
mailing list