in reply to Detecting cron

What would happen, though, if cron ran a k-shell script and the k-shell script ran .profile? Would I still be able to detect using the methods you describe?

Replies are listed 'Best First'.
Re: Re: Detecting cron
by tommyw (Hermit) on Aug 08, 2002 at 15:21 UTC

    That depends: if the .profile sets the environment variable you're testing for, then after it's been run, the variable exists. So you need to test first :-)

    OTOH, the .profile isn't going to have any effect on the arrangement of STDIN and STDOUT, so they'll still be safe to test (or safe to rely on the fact that STDIN just returns EOF...)

    --
    Tommy
    Too stupid to live.
    Too stubborn to die.