use mktemp(1) for temporary files

pull/1/head
Alessandro Mauri 3 years ago
parent 2d7d0e7f22
commit a5e0be8a3f
  1. 14
      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"
<div id="map">
@ -230,7 +230,7 @@ done
# Prepate the header
if ! [ "$SKIP_HEADER" ]; then
tmphead="tmpheadfile.tmp"
tmphead="$(mktemp)"
cp "$headerfile" "$tmphead"
sed -i '1s/^/<header>/' "$tmphead"
echo '</header>' >> "$tmphead"
@ -243,7 +243,7 @@ fi
# Prepare the footer
if ! [ "$SKIP_FOOTER" ]; then
tmpfoot="tmpfootfile.tmp"
tmpfoot="$(mktemp)"
cp "$footerfile" "$tmpfoot"
sed -i '1s/^/<footer>/' "$tmpfoot"
echo '</footer>' >> "$tmpfoot"

Loading…
Cancel
Save