Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Determine whether STDIN is a pipe?
February 16, 2009, 6:04 pm
rate this thread
but would like for it not to output the coloring escape sequences if
the output is being redirected to a program through a pipe.
In essence, it would act like grep's "--color=auto" flag.
Is there any way to test whether STDIN is going into a pipe?
Re: Determine whether STDIN is a pipe?
<optional coloured output>
You don't actually want to know if it's a pipe, you want to know if it's
a terminal. If it's redirected to a file presumably you still want b/w
In any case: see the -p and -t operators in perlfunc (you have to use
perldoc -f -X
to get the entry).
- » FAQ 6.11 How do I use a regular expression to strip C style comments from a file?
- — Next thread in » PERL Discussions
- » FAQ 6.7 How can I make "\w" match national character sets?
- — Previous thread in » PERL Discussions