#!/bin/ksh
if [ $# -eq 0 ]
then
echo "Usage: $0 [display_seconds] [command]"
else
time=$1
time="${time:-1}"
shift
while (true); do
date
eval $@
echo "run at $(date)"
sleep $time
wait
done;
fi
用法是sh timer.sh [秒數] [檔案+]
可以輸入多個檔案,會執行裏面的wc -l file指令....當然改掉這個就可以做其他事情了~
Reference: 60 second Timer with Shell Script
No comments:
Post a Comment