Neat trick: colorize bash input

As a frequent technical communicator, I often want to cut-and-paste something from my Unix terminal sessions so that other people can see what I’m seeing.

Unfortunately, it can be confusing to read:

Hello World in the Unix shell, without color

Hello World in the Unix shell, without color

Instead I want it to look like this:

Hello World in the Unix shell, in color

Hello World in the Unix shell, in color

How did I make this happen? Well, it’s a bit hacky, and it only works with the bash shell. Read on for more details.
Continue reading