Remove backup and fix files with spaces

This commit is contained in:
Augusto Gunsch 2021-09-19 18:08:14 -03:00
parent 5f51720bec
commit 1066da20f9
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 6 additions and 8 deletions

14
fsub
View File

@ -9,12 +9,11 @@ usage() {
exit 1 exit 1
} }
[ -z $1 ] && usage [ -z "$1" ] && usage
[ -f $1 ] || usage [ -f "$1" ] || 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
@ -44,6 +43,5 @@ BEGIN {
print time print time
for(j = 0; j < linen; j++) for(j = 0; j < linen; j++)
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