Add file backing up
This commit is contained in:
parent
bf4c067296
commit
5f51720bec
|
@ -7,3 +7,4 @@
|
||||||
# Features
|
# Features
|
||||||
- Fixes subtitle numbering
|
- Fixes subtitle numbering
|
||||||
- Removes lines which have words listed in `~/.config/fsubrc`
|
- Removes lines which have words listed in `~/.config/fsubrc`
|
||||||
|
- Backs up the file to a .bak (removed when no error happens)
|
||||||
|
|
2
fsub
2
fsub
|
@ -14,6 +14,7 @@ usage() {
|
||||||
[ -z $2 ] || usage
|
[ -z $2 ] || usage
|
||||||
[ -f $FSUBRC ] || touch $FSUBRC
|
[ -f $FSUBRC ] || touch $FSUBRC
|
||||||
|
|
||||||
|
cp $1 $1.bak
|
||||||
awk '
|
awk '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
n = 1
|
n = 1
|
||||||
|
@ -45,3 +46,4 @@ BEGIN {
|
||||||
print lines[j]
|
print lines[j]
|
||||||
}' $1 | sed 's/\r//' > /tmp/fsub
|
}' $1 | sed 's/\r//' > /tmp/fsub
|
||||||
mv /tmp/fsub $1
|
mv /tmp/fsub $1
|
||||||
|
rm $1.bak
|
||||||
|
|
Loading…
Reference in New Issue