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

run shellcheck

parent b4cc50ab
Pipeline #1834 passed with stage
in 5 minutes
#!/bin/bash #!/usr/bin/env bash
set -e set -e
...@@ -18,16 +18,11 @@ do ...@@ -18,16 +18,11 @@ do
for dir in "${arr[@]}" for dir in "${arr[@]}"
do do
if [[ "$OSTYPE" == "darwin"* ]]; then readarray -t filenames < <(jq .[].filename "$dir.json")
filenames=(`jq .[].filename $dir.json`) readarray -t timestamps < <(jq .[].date "$dir.json")
timestamps=(`jq .[].date $dir.json`)
else
readarray -t filenames < <(jq .[].filename "$dir.json")
readarray -t timestamps < <(jq .[].date "$dir.json")
fi
n=$(jq length "$dir.json") n=$(jq length "$dir.json")
includeFilename="download-$branch-$dir.html" includeFilename="download-$branch-$dir.html"
echo "" > $includeFilename echo "" > "$includeFilename"
for ((i = 0; i < n; i++)) for ((i = 0; i < n; i++))
do do
filename="${filenames[i]%\"}" filename="${filenames[i]%\"}"
...@@ -41,26 +36,30 @@ do ...@@ -41,26 +36,30 @@ do
version=${split[1]%.*} version=${split[1]%.*}
ext=${filename##*.} ext=${filename##*.}
else else
ext=`echo ${split[1]} | rev | cut -d. -f2 -f1 | rev` ext="$(echo "${split[1]}" | rev | cut -d. -f2,1 | rev)"
version=`echo ${split[1]} | cut -d. -f1 -f2 -f3` version="$(echo "${split[1]}" | cut -d. -f1,2,3)"
fi 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 else
timestamp="${timestamps[i]%\"}" timestamp="${timestamps[i]%\"}"
timestamp="${timestamp#\"}" timestamp="${timestamp#\"}"
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
datestr=`date -r $timestamp` datestr="$(date -r "$timestamp")"
else else
datestr=`date -d @$timestamp` datestr="$(date -d @"$timestamp")"
fi 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_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_right\"><a href=\"#\">$filename</a></div>" >> $includeFilename echo " <div class=\"download_cell_left\"><i class=\"fas fa-file-download\"></i>&nbsp;$datestr</div>"
echo "</div>" >> $includeFilename echo " <div class=\"download_cell_right\"><a href=\"#\">$filename</a></div>"
echo "</div>"
} >> "$includeFilename"
fi fi
done done
done done
rm -- *.json rm -- *json*
cd .. cd ..
done 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