[RFC PATCH 3/3] dohyphen2endash.sh: Use mktemp to create temp file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From a63dd50b648013af5780341f9c740bf9d9f6b65d Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Sat, 13 Aug 2016 11:02:39 +0900
Subject: [RFC PATCH 3/3] dohyphen2endash.sh: Use mktemp to create temp file

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 utilities/dohyphen2endash.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/utilities/dohyphen2endash.sh b/utilities/dohyphen2endash.sh
index 05557f0..2a0fdc7 100644
--- a/utilities/dohyphen2endash.sh
+++ b/utilities/dohyphen2endash.sh
@@ -59,16 +59,16 @@ then
 	exit 1
 fi
 texfiles=`find . -name '*.tex' -print`
+tmpf=`mktemp`
 for i in $texfiles
 do
 	basename="${i%.tex}"
 #	echo $basename
-	sh ./utilities/hyphen2endash.sh $basename.tex > $basename.tmp
-	if diff -q $basename.tex $basename.tmp >/dev/null
+	sh ./utilities/hyphen2endash.sh $basename.tex > $tmpf
+	if ! diff -q $basename.tex $tmpf >/dev/null
 	then
-		rm $basename.tmp
-	else
 		echo "$basename.tex modified"
-		mv -f $basename.tmp $basename.tex
+		cp -f $tmpf $basename.tex
 	fi
 done
+rm -f $tmpf
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux