in reply to Detecting running from cron?

You have some ad hoc environment var methods above which I would avoid. The "official" and far more portable way is using tilly's method with -t which is equivalent to the POSIX::isatty(...).
AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Replies are listed 'Best First'.
Re: Re: Detecting running from cron?
by chipmunk (Parson) on Jan 24, 2001 at 01:31 UTC
    Official, portable, and solves a different problem. -t tells you whether a filehandle is connected to a TTY; it does not tell you whether you are running from the command line.

    Any filehandle you can test with -t can be redirected on the command line. Using -t to ask "is the script running from the command line?" will result in false negatives.

    P.S. Did you mean tye's method?