#!/bin/sh . config.sh TRONHOME=.. PATH=$TRONHOME/bin:$PATH export TRONHOME PATH echo 'Content-type: text/plain Robot Ranking: How our robots are doing tot = Number of games played by the robot won = Number of games won by the robot w/t = Won/tot pts = Won - Lost id = Unique id number of the robot. pts w/t won tot robot_id ' $PSQL -q -t -c ' select rid,won,tied,lost from allrobots' tron | awk -F\| ' { games=$2+$3+$4; if (games == 0) rate = 0; else rate = $4/games; points = $4 - $2; printf("%4d %4.2f %3d %3d %s",points,rate,$4, games,$1); if (games <= 10) printf(" *"); printf("\n"); } ' | sort -r -n