Não de cat
em si, mas você pode usar algo como fonte highlite ou supercat ou destaque
Source-highlight
This program, given a source file, produces a document with syntax highlighting. It also provides a C++ highlight library (new) (since version 3.0).
Source-highlight reads source language specifications dynamically, thus it can be easily extended (without recompiling the sources) for handling new languages. It also reads output format specifications dynamically, and thus it can be easily extended (without recompiling the sources) for handling new output formats. The syntax for these specifications is quite easy (take a look at the manual).
The manual about installation:
See the file INSTALL for detailed building and installation instructions; anyway if you're used to compiling Linux software that comes with sources you may simply follow the usual procedure, i.e., untar the file you downloaded in a directory and then:
cd <source code main directory>
./configure
make
make install
Supercat
This is Supercat's homepage. Supercat is a program that colorizes text based on matching regular expressions/strings/characters. Supercat supports html output as well as standard ASCII text. Unlike some text-colorizing programs that exist, Supercat does not require you to have to be a programmer to make colorization rules.
If you have written a supercat config file for a standard file type please do not hesitate to contact me at "bug-spc (at) nosredna (dot) net" for possible inclusion in the supercat distribution.
Ou com uma função ( source ) :
#!/bin/bash#!/bin/bash
if [ ! -t 0 ];then
file=/dev/stdin
elif [ -f $1 ];then
file=$1
else
echo "Usage: $0 code.c"
echo "or e.g. head code.c|$0"
exit 1
fi
pygmentize -f terminal -g $file
Requer: Pygments ( sudo apt-get install python-pygments python3-pygments
)
Adicioná-lo como uma função para bash .functions e dar-lhe um nome como color ()