if [ "$#" -ne 2 ]; then
echo "usage: $0 [filename] [repeat count]"
exit
fi
if [ -f "$1" ]; then
echo "$1 file exists."
else
echo "$1 No such file. will exit"
exit
fi
fileName=$(echo $1 | cut -d"." -f1)
fileCount=0
modInterval=$(( $2 / 10 ))
until [ "$fileCount" -ge $2 ]; do
fileCount=$(expr $fileCount + 1)
modulo=$(( $fileCount % $modInterval ))
if [ $modulo -eq 0 ]; then
echo "current fileCount: $fileCount completed"
fi
cp -f $1 "$fileName$fileCount.mpg"
done
===================================================
뭔가 주기적으로 반복할때
#!/bin/bash
while true
do
TODAY=$(date)
echo "$TODAY excute command 'rm -rf Session*' "
rm -rf Session*
sleep 1800
done
댓글 없음:
댓글 쓰기