I have a ksh script that must work on both linux and solaris. I'm trying to color the output of specific commands. It works on linux (specifically RHEL6), but not on solaris (SunOS 5.10).
Command on linux (the output "test" is correctly colored red):
[amartin@linuxbox:~]$ echo "test" | sed 's,.*,\x1B[31m&\x1B[0m,' test
Command on solaris (the output "test" is not colored):
[amartin@sunbox:~]$ echo "test" | sed 's,.*,\x1B[31m&\x1B[0m,' x1B[31mtestx1B[0m
Is there a way to craft this command such that the output is red, without the raw codes in the output? I can't change the 'echo' command because that's just a fill in for the command I'm actually running.