From: Harry Ohlsen Date: 2003-07-29T13:54:48+09:00 Subject: Re: How do I tell when my CLI output is piped? David Landrith wrote: > ... I'd like > to be able to automatically sense when the output is being piped to > somewhere else, so that I can automatically make the report switch to a > tab delimited format a la the mysql command line client. In C, this is normally done using the standard library routine isatty(file_descriptor) which returns non-zero when output is going to a terminal. Looking at the documentation for IO in pickaxe, there is an isatty() method. So, I would imagine you can do something like (completely untested!) ... if $stdout.isatty puts "Going to a terminal" else puts "Going somewhere else" end Note that this would also include if you redirect the output to a file. Hope that helps. Harry O.