Dev/기타

shell script로 구현하는 multi tail

newtype 2013. 8. 6. 13:32


multi tail 유틸은 이미 있습니다.


http://www.vanheusden.com/multitail/


하지만, 설치를 해야 하죠


간단하게 shell script로 구현 하는 방법이 있어서 소개 합니다.



$ vi multitail.sh

#!/bin/ksh

function sig_int
{
   echo 'sig_int'
   kill `jobs -p`
}

for file in "$@"
do
  tail -f $file &
done
trap 'sig_int' 2

wait


이상입니다.

반응형