#!/bin/sh
function clean()
{
jobs -p|xargs kill -9
}
files=$@
trap "clean $files " EXIT
for file in "$@"
do
tail -f $file &
done
wait
使用方法:./multail.sh 文件1名 文件2名 ... 文件n名
结束方法: CTRL+C
another tool multitail
multitail /var/log/apache/access.log -I /var/log/apache/error.log