Maybe check -t STDIN (would test if STDIN is opened to a tty) — see filetests
In reply to Re: Detect Environment by almut in thread Detect Environment by igoryonya