Colorizing 'cat' with source-highlight, dump code in color

I always wanted to colorize a 'cat' of a file (lord knows why?!), but tonight, I figured out how to do it!

What you need

You need to install the packages

  • highlight
  • source-highlight

In Fedora, its as easy as

yum install -y highlight source-highlight

After this is complete, generate the script called 'scat' in /usr/bin:

#!/bin/bash
INFILE="$1"

if [ -n "$2" ]; then
        OPTS="-S $2"
fi

highlight $INFILE -A $OPTS