Commit 46f19d1b authored by Houtan Bastani's avatar Houtan Bastani

run shellcheck

parent b4cc50ab
#!/bin/bash
#!/usr/bin/env bash
set -e
......@@ -18,16 +18,11 @@ do
for dir in "${arr[@]}"
do
if [[ "$OSTYPE" == "darwin"* ]]; then
filenames=(`jq .[].filename $dir.json`)
timestamps=(`jq .[].date $dir.json`)
else
readarray -t filenames < <(jq .[].filename "$dir.json")
readarray -t timestamps < <(jq .[].date "$dir.json")
fi
readarray -t filenames < <(jq .[].filename "$dir.json")
readarray -t timestamps < <(jq .[].date "$dir.json")
n=$(jq length "$dir.json")
includeFilename="download-$branch-$dir.html"
echo "" > $includeFilename
echo "" > "$includeFilename"
for ((i = 0; i < n; i++))
do
filename="${filenames[i]%\"}"
......@@ -41,26 +36,30 @@ do
version=${split[1]%.*}
ext=${filename##*.}
else
ext=`echo ${split[1]} | rev | cut -d. -f2 -f1 | rev`
version=`echo ${split[1]} | cut -d. -f1 -f2 -f3`
ext="$(echo "${split[1]}" | rev | cut -d. -f2,1 | rev)"
version="$(echo "${split[1]}" | cut -d. -f1,2,3)"
fi
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename\">Dynare $version ($ext)</a>" >> $includeFilename
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename.sig\">[signature]</a>" >> $includeFilename
{
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename\">Dynare $version ($ext)</a>"
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename.sig\">[signature]</a>"
} >> "$includeFilename"
else
timestamp="${timestamps[i]%\"}"
timestamp="${timestamp#\"}"
if [[ "$OSTYPE" == "darwin"* ]]; then
datestr=`date -r $timestamp`
datestr="$(date -r "$timestamp")"
else
datestr=`date -d @$timestamp`
datestr="$(date -d @"$timestamp")"
fi
echo "<div class=\"download_row\" onclick=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\" onkeypress=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\">" >> $includeFilename
echo " <div class=\"download_cell_left\"><i class=\"fas fa-file-download\"></i>&nbsp;$datestr</div>" >> $includeFilename
echo " <div class=\"download_cell_right\"><a href=\"#\">$filename</a></div>" >> $includeFilename
echo "</div>" >> $includeFilename
{
echo "<div class=\"download_row\" onclick=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\" onkeypress=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\">"
echo " <div class=\"download_cell_left\"><i class=\"fas fa-file-download\"></i>&nbsp;$datestr</div>"
echo " <div class=\"download_cell_right\"><a href=\"#\">$filename</a></div>"
echo "</div>"
} >> "$includeFilename"
fi
done
done
rm -- *.json
rm -- *json*
cd ..
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment