On Friday 07 May 2010 08:49:26 Greg Wooledge wrote:
> On Thu, May 06, 2010 at 09:30:20AM -0500, Chuck Remes wrote:
> > e.g.
> > [ -z "$PS1" ] && return
>
> That's certainly *not* how I'd write that check. If the goal is to
> protect a block of commands from running when the shell is invoked
> without a terminal, then I'd prefer this:
>
> if [ -t 1 ]; then
> # All your terminal commands go here
> stty kill ^u susp ^z intr ^c
> ...
> fi
the somewhat common test ive seen in different distros to detect interactive
shells is:
if [[ $- != *i* ]] ; then
# shell is non-interactive
return
fi
-mike
signature.asc Description: This is a digitally signed message part.