Add file backing up

This commit is contained in:
Augusto Gunsch 2021-08-29 11:08:01 -03:00
parent bf4c067296
commit 5f51720bec
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
2 changed files with 3 additions and 0 deletions

View File

@ -7,3 +7,4 @@
# Features
- Fixes subtitle numbering
- Removes lines which have words listed in `~/.config/fsubrc`
- Backs up the file to a .bak (removed when no error happens)

2
fsub
View File

@ -14,6 +14,7 @@ usage() {
[ -z $2 ] || usage
[ -f $FSUBRC ] || touch $FSUBRC
cp $1 $1.bak
awk '
BEGIN {
n = 1
@ -45,3 +46,4 @@ BEGIN {
print lines[j]
}' $1 | sed 's/\r//' > /tmp/fsub
mv /tmp/fsub $1
rm $1.bak