Re: login shell?



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
.



Relevant Pages

  • Re: Backup scheme
    ... Here's a great script I use that is written in Perl. ... HTH, ... The script I am using is just using system renames and I would like to truly do this in Perl. ...
    (perl.beginners)
  • Re: [newbie] Year in two digits; Time with leading zero
    ... Gilles Ganault wrote: ... As indicated in the subject line, I don't Perl, but I must ... write a short script in it. ...
    (comp.lang.perl.misc)
  • login shell?
    ... Is there a way to determine in perl whether the current script was run from ... a login shell or not? ... Prev by Date: ...
    (perl.beginners)
  • Re: Yahoo! Getter
    ... On Mon, 2003-11-24 at 23:56, Jason Dusek wrote: ... > Let's say I want to write a script that: ... It's even written in Perl! ... HTH, ...
    (perl.beginners)
  • Re: Problems with a modems under linux
    ... PACKAGEDIR/scripts/debian/slmodemd script or do I use the ... Debian boxes at work are all running on 32-bit hardware. ... but I don't think you point pppd at that device. ... Oh well, HTH, ...
    (comp.os.linux.portable)