From a5e0be8a3f103dec4cb77ebc164ba1e458cdbdb6 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Fri, 18 Jun 2021 13:26:05 +0200 Subject: [PATCH] use mktemp(1) for temporary files --- rivet.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rivet.sh b/rivet.sh index eb4dee2..65d0064 100644 --- a/rivet.sh +++ b/rivet.sh @@ -54,7 +54,7 @@ convert() { infile="$1" extension="${infile##*.}" if [ "$extension" = 'md' ]; then - tmpfile="tmpconvfile.tmp" + tmpfile="$(mktemp)" outfile="${infile%md}html" cp "$infile" "$tmpfile" lowdown --html-no-skiphtml --html-no-escapehtml -s -Thtml \ @@ -108,8 +108,8 @@ unset src headerfile=$srcdir/_header.html footerfile=$srcdir/_footer.html metafile=$srcdir/_metadata.html -objlist=objlist.tmp -objdate=objdate.tmp +objlist="$(mktemp)" +objdate="$(mktemp)" # Check if index.md is present if ! [ -e "$srcdir"/index.md ]; then @@ -181,7 +181,7 @@ done < "$objlist" sed -i -e 's/\.md$/\.html/' "$objlist" # Create a list that contains the links to all html files -linklist=linklist.tmp +linklist="$(mktemp)" cp -f "$objlist" "$linklist" sed -i -e "s/^$destdir//" -e "s/^/$prefix:\/\/$domain/" "$linklist" @@ -195,7 +195,7 @@ fi # Prepare index file list if ! [ "$SKIP_LIST" ]; then - tmpfile="linkindex.tmp" + tmpfile="$(mktemp)" rm -f "$tmpfile" cat << EOF >> "$tmpfile"
@@ -230,7 +230,7 @@ done # Prepate the header if ! [ "$SKIP_HEADER" ]; then - tmphead="tmpheadfile.tmp" + tmphead="$(mktemp)" cp "$headerfile" "$tmphead" sed -i '1s/^/
/' "$tmphead" echo '
' >> "$tmphead" @@ -243,7 +243,7 @@ fi # Prepare the footer if ! [ "$SKIP_FOOTER" ]; then - tmpfoot="tmpfootfile.tmp" + tmpfoot="$(mktemp)" cp "$footerfile" "$tmpfoot" sed -i '1s/^/' >> "$tmpfoot"