The following shell script works but removes colored formatting generated by rspec:
#!/bin/bash
OUTPUT=`rspec`
echo "$OUTPUT"
How to preserve the colors?
|
The following shell script works but removes colored formatting generated by
How to preserve the colors? |
|||
|
It's common for programs with colorized output to disable it if they're not being run directly in a TTY, since you might be piping the output to a log file or to another process that expects plain text. Typically the programs offer a switch to manually force colors enabled, and I think your only options are to edit |
|||
|
|
rspecis simply not doing color formatting when not outputting directly to terminal. You need to find an option like--color=alwaysto force color. The shell isn't stripping the color sequences - it doesn't even know how to do so. Why are you trying to save colored output in a variable anyways? Just output it directly. – jw013 Oct 31 '12 at 14:03