Skip to content
Advertisement

Bash terminal and color output [closed]

I have a shell with colors enabled:

man -P cat blabla > afile

somefile contains escape characters for coloring. Now I want to output somefile to the terminal with its coloring. I tried:

cat afile

But there isn’t any formatting at all. The only way I found is by using

less afile

But I don’t want a pager. I just want to output the file and do not enter some interactive mode. There must be a simple command to do that, but I wasn’t able to find it 🙂

Advertisement

Answer

The command I was looking for is called ul (do underlining):

/usr/bin/man -P cat somecommand | ul

It formats the BACKSPACE escape format from groff nicely for the terminal.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement