You are not logged in.

#1 2003-12-14 20:45:56

neolution
Member
From: RIT
Registered: 2003-12-11
Posts: 15
Website

shell program, check for interactive login

hey, i'm fairly new to *nix programming in general

i want fortune to run for users at login time,
however i can't just slap fortune into the .bashrc file b/c that will not provide sftp a 'clean' environment for the added output to a noninteractive session messes up ssh do to its unix like implementation of things

anyway my question is a simple one, how do i check for an interactive session, where there is a tty attached to the standard input, or however it makes sense to be said.

i picked up an o'reilly bash ebook through my library but haven't had a chance to read it yet, so an example code snippet would be helpful if possible


thanks for the help


Hey what are you guys trying to pull, issue 0x0f is the same as 0x16"

Offline

#2 2003-12-14 21:21:09

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: shell program, check for interactive login

neolution wrote:

anyway my question is a simple one, how do i check for an interactive session, where there is a tty attached to the standard input, or however it makes sense to be said.

That very question can be answered with :

tty -s && fortune

However, I'm not sure if this solves your problem, since sftp may actually provide a tty ... I simply don't have any experience with sftp.

i picked up an o'reilly bash ebook through my library but haven't had a chance to read it yet, so an example code snippet would be helpful if possible

and since you intend to read up, I can only encourage you to do so, and I won't give an explanation of the above, so you have something to read up ;-)

Offline

#3 2003-12-14 22:42:29

neolution
Member
From: RIT
Registered: 2003-12-11
Posts: 15
Website

Re: shell program, check for interactive login

thanks, worked like a charm,

looking forward to figuring out how it works


Hey what are you guys trying to pull, issue 0x0f is the same as 0x16"

Offline

Board footer

Powered by FluxBB