retire nonsymbolic rootdev, dev2name
[minix.git] / commands / rotate / rotate.sh
blobe6dc22994210809ec2f7e036c2f666e2ad503a85
1 #!/bin/sh
2 BZIP=/usr/local/bin/bzip2
3 RM="rm -f"
4 MV="mv -f"
6 if [ $# -ne 2 ]
7 then echo "Usage: $0 <log> <keep>"
8 exit 1
9 fi
11 if [ ! -f "$1" ]
12 then exit 1
15 if [ ! -x "$BZIP" ]
16 then exit 1
19 if [ "$2" -le 0 ]
20 then echo "Keep at least 1 copy please."
21 exit 1
24 k="$2"
25 $RM "$1.$k" 2>/dev/null || exit 1
26 while [ "$k" -ge 2 ]
27 do prev="`expr $k - 1`"
28 $MV $1.$prev.bz2 $1.$k.bz2 2>/dev/null
29 k=$prev
30 done
31 $BZIP -c $1 >$1.1.bz2 && : >$1