Add bak script to rotate backup files
This commit is contained in:
parent
e1daaba387
commit
601087f724
1 changed files with 14 additions and 0 deletions
14
bin/bak
Executable file
14
bin/bak
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
bakrotate() {
|
||||||
|
if [ -f $1 ]
|
||||||
|
then
|
||||||
|
if [ -f "$1.bak" ]
|
||||||
|
then bakrotate "$1.bak"
|
||||||
|
fi
|
||||||
|
mv "$1" "$1.bak"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
bakrotate "$1.bak"
|
||||||
|
cp $1 $1.bak
|
Loading…
Reference in a new issue