On 7/27/05, JupiterHost.Net <[EMAIL PROTECTED]> wrote: > > > Bryan R Harris wrote: > > > > Is there a way to determine in perl whether the current script was run from > > a login shell or not? > > if(-t STDIN) { > print "Hello terminal\n"; > } else { > print "Content-type: text/html\n\n"; > print "Hello <b>Browser</b>\n"; > } > > HTH :)
That doesn't do what you probably want it to do; see my comments above. Or just consider the following: ~/perl> perl -e 'if (-t STDIN){print "terminal\n";}else{print "html\n";}' terminal ~/perl> perl -e 'if (-t STDIN){print "terminal\n";}else{print "html\n";}' < some.file html You don't even have to read from <>, there just has to be command line redirection HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>