#!/usr/bin/env bash
#
tail -F \
/var/log/maillog \
/var/log/messages \
|
while read -r line
do printf \
"\033[38;5;%dm%s\033[0m\n" \
$(($RANDOM%214+17)) \
"$line"
done
#
# Follow log files, showing each
# line in a random color.
# Needs a 256-color terminal,
# works best on dark/black
# backgrounds.
#
Related: If you want to follow log files that are rotated, regularly or on reaching a certain size, use `tail -F` instead of `tail -f`. The difference is that -F tells `tail` to reopen the file if it's truncated or deleted/moved and recreated.