repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
etc/services - sync with NetBSD-8
[minix.git]
/
minix
/
commands
/
rotate
/
rotate.sh
blob
9b478de0151ef347315729d1c227079db3ceb6cf
1
#!/bin/sh
2
BZIP
=/
usr
/
bin
/
bzip2
3
RM
=
"rm -f"
4
MV
=
"mv -f"
5
6
if
[
$#
-ne
2
]
7
then
echo
"Usage:
$0
<log> <keep>"
8
exit
1
9
fi
10
11
if
[ !
-f
"
$1
"
]
12
then
exit
1
13
fi
14
15
if
[ !
-x
"
$BZIP
"
]
16
then
exit
1
17
fi
18
19
if
[
"
$2
"
-le
0
]
20
then
echo
"Keep at least 1 copy please."
21
exit
1
22
fi
23
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