Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any common Linux utility or easy shell script that I can use to launch apps such that anything they print to stdout/stderr that would affect the terminal behavior (perhaps w/ an option to leave colors) gets filtered out? 'less' has an option for this, -R, but I'd like to be able to launch arbitrary programs with this filtering, for example:

termfilter ./mybuggyapp

And termfilter would take care of filtering any non-color non-printable chars on both stdout and stderr, but still let me use pipes, redirection, etc. to send that output around. Or even better, if it only did the filtering when it detected stdout/stderr weren't connected to a TTY.

Obviously, this would break apps that need to send such control codes (like screen, ncurses GUIs, etc.) but I mostly want it to protect myself against bad programming in apps that are only intended to print standard ASCII text.

share|improve this question
1  
Could you write a bash function that pipes STDOUT and STDERR separately through cat -v (or tr that deletes control characters other than LF and tab). Then you can still use further redirection/pipes – RedGrittyBrick Aug 28 '12 at 20:39

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.