I want something where I can do `{some command} | red` and it'll output whatever `{some command}` would have outputted, but red. The best I've been able to do is

```
function red()
{
    while read text
    do
        echo -e '\033[31m'$text'\033[0m'
    done
}

```

But this removes all the indentation.

This seems like something that should be easy but I just can't seem to figure it out. I was trying to do it just for fun but now I just need to know, 'cause there has to be a simple way to do this that I'm missing.

EDIT:

I've also tried this in C like so:

```
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char* buffer = malloc(8);
    int size     = 8;
    int index    = 0;

    while ((buffer[index++] = getchar()) != EOF)
    {
        if (index == size)
        {
            size *= 2;
            buffer = realloc(buffer, size);
        }
    }
    buffer[index] = 0;

    printf("%s%s%s", "\\033[31m", buffer, "\\033[0m");
}

```

But the shell doesn't interpret the escape characters, and so doesn't make the output red.