[Swift-commit] r7244 - provenancedb/tags
wilde at ci.uchicago.edu
wilde at ci.uchicago.edu
Tue Oct 29 15:32:39 CDT 2013
Author: wilde
Date: 2013-10-29 15:32:39 -0500 (Tue, 29 Oct 2013)
New Revision: 7244
Modified:
provenancedb/tags/locate.server
Log:
Use mktemp for temp files and clean up on exit.
Modified: provenancedb/tags/locate.server
===================================================================
--- provenancedb/tags/locate.server 2013-10-29 20:19:35 UTC (rev 7243)
+++ provenancedb/tags/locate.server 2013-10-29 20:32:39 UTC (rev 7244)
@@ -23,13 +23,17 @@
# echo -e "$QUERY\n"
-$SQLCMD -c "$QUERY" >t.out
-head -2 t.out >t.hdr
-tail -n +3 t.out | sort >t.body
+tout=$(mktemp /tmp/tags.out.XXXXXX)
+thdr=$(mktemp /tmp/tags.hdr.XXXXXX)
+tbody=$(mktemp /tmp/tags.body.XXXXXX)
+$SQLCMD -c "$QUERY" >$tout
+head -2 $tout >$thdr
+tail -n +3 $tout | sort >$tbody
+
if [ $format = default ]; then
-cat t.hdr t.body | awk '
+cat $thdr $tbody | awk '
BEGIN {
start=0
for(i=0;i<1024;i++) spaces = spaces " ";
@@ -54,7 +58,7 @@
elif [ $format = cols ]; then
-cat t.hdr t.body | awk '
+cat $thdr $tbody | awk '
BEGIN {
start=0
for(i=0;i<1024;i++) spaces = spaces " ";
@@ -80,6 +84,7 @@
fi
+rm -f $tout $tbody $thdr
exit
More information about the Swift-commit
mailing list