From 5f51720bec2d470fd58ca4389630478c441ca7d4 Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Sun, 29 Aug 2021 11:08:01 -0300 Subject: [PATCH] Add file backing up --- README.md | 1 + fsub | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index d5f5dc9..844a149 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/fsub b/fsub index 6cc963d..4a56445 100755 --- a/fsub +++ b/fsub @@ -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