#!/bin/bash

entryNum=0

cat entries.csv | while read line; do
  IFS=","
  entry=($line)
  if [ -z ${entry[1]} ]; then
    entry[1]="<untitled>"
  fi
  bonusPen="bonus"
  if [ "${entry[5]}" -lt 0 ]; then
    bonusPen="penalty"
  fi
  echo "# Entry #$entryNum: ${entry[3]}"
  echo "## by ${entry[1]}"
  echo "\`${entry[0]}\` - ${entry[6]} - $bonusPen: ${entry[5]}"
  echo

  entryNum=$((entryNum+1))
done
