Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Testing if a file is a terminal?



On Dec 11, 12:33pm, Rocky Bernstein wrote:
} Subject: Re: Testing if a file is a terminal?
}
} David Korn has weighed in on this with respect to ksh.
} 
} Here is code along he lines he has suggested (my formatting and other
} small changes which may have introduced bugs):

This is almost exactly what I suggested, except I omitted the

  exec {fd}<&-

because you expressed concern about opening and then closing again
the terminal device.  In fact, I might even suggest:

	    if [[ -t $fd  ]] ; then
		r=0
	    else
		exec {fd}<&-
	    fi



Messages sorted by: Reverse Date, Date, Thread, Author