Re: login shell?
- From: daggerquill@xxxxxxxxx (Jay Savage)
- Date: Thu, 28 Jul 2005 13:24:42 -0400
On 7/27/05, JupiterHost.Net <mlists@xxxxxxxxxxxxxxx> 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
.
- References:
- login shell?
- From: Bryan R Harris
- Re: login shell?
- From: JupiterHost.Net
- login shell?
- Prev by Date: Getting Date Stamp of a file on a Win32 System
- Next by Date: RE: open > file && s/ / /;
- Previous by thread: Re: login shell?
- Next by thread: defined on hash value does not work in my code :(
- Index(es):
Relevant Pages
|