> On Mon, 29 Mar 2004 00:38:50 -0700 > Bryan Harris <[EMAIL PROTECTED]> wrote: > >>> Alternatively, you can use the '-t' operator: >>> >>> exit 0 if -t STDIN >> >> >> I've been waiting for this for a LONG time, thanks Smoot. > > No problem. It took me a while to find the correct operator as well. > > Please keep in mind that doing this breaks the de facto Unix standard > for filters. A simply command which is a filter (e.g takes > input from STDIN and sends output to STDOUT) is written without any > consideration whether the input is a terminal, pipe, socket or > otherwise. This makes it very simple to use the command in a pipeline or > standalone from the terminal.
[stuff cut out] Smoot, Strangely, I find that we almost always want our scripts to act this way. If any files or data is passed to the script, then it uses it. Otherwise, it prints usage instructions (since we'd rather not have man pages for scripts, and I don't know how to build them anyway). I mention this because I'm interested in hearing your thoughts on this methodology. By the way, what's a socket? - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>