Bash code-render.sh

```
#! /bin/bash

# version.
#
# details.
#
# this program. If not, see <http://www.gnu.org/licenses/>

OUT=stdout
ERR=stderr
ARGS="-W500 -H375 +D1 +A0.3 +AM2 -J -R3 +UA -KFI1 -KFF36 -KI0 -KF1 \
 +KC -L~/povray/poly"
THUMB="-W60 -H45 +D1 +A0.3 +AM2 -J -R3 +UA -KFI1 -KFF36 -KI0 -KF1 \
 +KC -L~/povray/poly Declare=OmitFloor=1 Declare=OmitVertices=1 \
 Declare=OmitEdges=1"

MOVE=\\033[30G
RED=\\033[31m
GREEN=\\033[32m
YELLOW=\\033[33m
BLUE=\\033[34m
MAGENTA=\\033[35m
CYAN=\\033[36m
WHITE=\\033[37m
function RenderOne {
 DATE=$(date +%H:%M:%S)
 echo -n $DATE $1
 echo $1 >>$ERR
 povray $ARGS -I$1/$1.pov >>$OUT 2>>$ERR
 case $? in
 0 )
 printf "${MOVE}[ ${GREEN}OK${WHITE} ]"
 convert $1/$1??.png -background '#ffffe0' -alpha remove \
 gifs/$1.gif || \
 printf " - ${RED}Error $? converting${WHITE}"
 povray $THUMB -I$1/$1.pov >>$OUT 2>>$ERR
 convert $1/$1??.png -background '#ffffe0' -alpha remove \
 gifs/$1-thumb.gif || \
 printf " - ${RED}Error $? converting thumb${WHITE}"
 echo ""
 ;;
 1 )
 printf "${MOVE}[${RED}Error${WHITE} ]\n"
 ;;
 2 )
 printf "${MOVE}[${YELLOW}I'rupt${WHITE}]\n"
 exit
 ;;
 129 )
 printf "${MOVE}[${MAGENTA}SIGHUP{WHITE}]\n"
 ;;
 130 )
 printf "${MOVE}[${MAGENTA}SIGINT{WHITE}]\n"
 ;;
 131 )
 printf "${MOVE}[${MAGENTA}SIGQUI{WHITE}]\n"
 ;;
 132 )
 printf "${MOVE}[${MAGENTA}SIGILL{WHITE}]\n"
 ;;
 133 )
 printf "${MOVE}[${MAGENTA}SIGTRA{WHITE}]\n"
 ;;
 134 )
 printf "${MOVE}[${MAGENTA}SIGABR{WHITE}]\n"
 ;;
 135 )
 printf "${MOVE}[${MAGENTA}SIGBUS{WHITE}]\n"
 ;;
 136 )
 printf "${MOVE}[${MAGENTA}SIGFPE{WHITE}]\n"
 ;;
 137 )
 printf "${MOVE}[${MAGENTA}SIGKIL{WHITE}]\n"
 ;;
 138 )
 printf "${MOVE}[${MAGENTA}SIGUS1{WHITE}]\n"
 ;;
 139 )
 printf "${MOVE}[${MAGENTA}SIGSEG{WHITE}]\n"
 ;;
 140 )
 printf "${MOVE}[${MAGENTA}SIGUS2{WHITE}]\n"
 ;;
 141 )
 printf "${MOVE}[${MAGENTA}SIGPIP{WHITE}]\n"
 ;;
 142 )
 printf "${MOVE}[${MAGENTA}SIGALR{WHITE}]\n"
 ;;
 143 )
 printf "${MOVE}[${MAGENTA}SIGTER{WHITE}]\n"
 ;;
 145 )
 printf "${MOVE}[${MAGENTA}SIGCHI{WHITE}]\n"
 ;;
 146 )
 printf "${MOVE}[${MAGENTA}SIGCON{WHITE}]\n"
 ;;
 147 )
 printf "${MOVE}[${MAGENTA}SIGSTO{WHITE}]\n"
 ;;
 148 )
 printf "${MOVE}[${MAGENTA}SIGTST{WHITE}]\n"
 ;;
 149 )
 printf "${MOVE}[${MAGENTA}SIGTTI{WHITE}]\n"
 ;;
 150 )
 printf "${MOVE}[${MAGENTA}SIGTTO{WHITE}]\n"
 ;;
 151 )
 printf "${MOVE}[${MAGENTA}SIGURG{WHITE}]\n"
 ;;
 152 )
 printf "${MOVE}[${MAGENTA}SIGXCP{WHITE}]\n"
 ;;
 153 )
 printf "${MOVE}[${MAGENTA}SIGXFS{WHITE}]\n"
 ;;
 154 )
 printf "${MOVE}[${MAGENTA}SIGVTA{WHITE}]\n"
 ;;
 155 )
 printf "${MOVE}[${MAGENTA}SIGPRO{WHITE}]\n"
 ;;
 156 )
 printf "${MOVE}[${MAGENTA}SIGWIN{WHITE}]\n"
 ;;
 157 )
 printf "${MOVE}[${MAGENTA}SIGIO {WHITE}]\n"
 ;;
 158 )
 printf "${MOVE}[${MAGENTA}SIGPWR{WHITE}]\n"
 ;;
 159 )
 printf "${MOVE}[${MAGENTA}SIGSYS{WHITE}]\n"
 ;;
 128 | 144 | 1[6-9][0-9] | 2[0-9][0-9] )
 printf "${MOVE}[${MAGENTA}SIG${CYAN}$?${WHITE}]\n"
 ;;
 * )
 printf "${MOVE}[${MAGENTA}Uknown${WHITE}] code $? encountered"
 ;;
 esac
}

REDIRECT=">>$OUT 2>>$ERR"
echo "">$OUT
echo "">$ERR

# Prisms
echo "\*\*\* Prisms \*\*\*"
for POLY in trip pip stip hip hep ship giship op stop ep step gistep \
 dip stiddip; do
 RenderOne $POLY
done
# Antiprisms
echo "\*\*\* Antiprisms \*\*\*"
for POLY in squap pap hap heap oap eap dap stap sithap steap stiddap \
 sterp gisthap stoap gisthirp gisteap storp \
 gisterp; do
 RenderOne $POLY
done
# Regulars
echo "\*\*\* Regulars \*\*\*"
for POLY in tet cube oct doe ike gad sissid gike gissid; do
 RenderOne $POLY
done
# Truncates
echo "\*\*\* Truncates \*\*\*"
for POLY in tut tic toe tid ti tigid tiggy quith quit-sissid \
 quit-gissid; do
 RenderOne $POLY
done
# Quasiregulars
echo "\*\*\* Quasiregulars \*\*\*"
for POLY in thah co oho cho id sidhid seihid did sidhei \
 gidhei gid gidhid geihid sidtid ditdid \
 gidtid; do
 RenderOne $POLY
done
# Trapezoverts
echo "\*\*\* Trapezoverts \*\*\*"
for POLY in sirco socco sroh srid saddid sird raded ided ri \
 gocco querco groh gidditdid giid giddy siid \
 sidditdid siddy gaddid qrid gird; do
 RenderOne $POLY
done
# Omnitrucates
echo "\*\*\* Omnitruncates \*\*\*"
for POLY in girco grid quitco quitdid gaquatid cotco idtid; do
 RenderOne $POLY
done
# Snubs
echo "\*\*\* Snubs \*\*\*"
for POLY in snic snid siddid gosid seside isdid gisid sided \
 gisdid girsid sirsid gidrid; do
 RenderOne $POLY
done
# Compounds
echo "\*\*\* Compounds \*\*\*"
for POLY in sto cube-oct doe-ike 5cube 5tet 10tet; do
 RenderOne $POLY
done

# Johnson solids: pyramids
echo "\*\*\* Johnson solids: pyramids \*\*\*"
for POLY in j01 j02; do
 RenderOne $POLY
done
# Johnson solids: cupolae & rotundae
echo "\*\*\* Johnson solids: cupolae & rotundae \*\*\*"
for POLY in j03 j04 j05 j06; do
 RenderOne $POLY
done
# Johnson solids: modified pyramids
echo "\*\*\* Johnson solids: modified pyramids \*\*\*"
for POLY in j07 j08 j09 j10 j11 j12 j13 j14 j15 j16 j17; do
 RenderOne $POLY
done
# Johnson solids: augmented cupolae & rotundae
echo "\*\*\* Johnson solids: augmented cupolae & rotundae \*\*\*"
for POLY in j18 j19 j20 j21 j22 j23 j24 j25 j26 j27 j28 j29 j30 j31 j32 j33 \
 j34 j35 j36 j37 j38 j39 j40 j41 j42 j43 j44 j45 j46 j47 j48; do
echo RenderOne $POLY
done
# Johnson solids: augmented prisms
echo "\*\*\* Johnson solids: augmented prisms \*\*\*"
for POLY in j49 j50 j51 j52 j53 j54 j55 j56 j57; do
 RenderOne $POLY
done
# Johnson solids: modified uniform polyhedra
echo "\*\*\* Johnson solids: modified uniform polyhedra \*\*\*"
for POLY in j58 j59 j60 j61 j62 j63 j64 j65 j66 j67 j68 j69 j70 j71 j72 j73 \
 j74 j75 j76 j77 j78 j79 j80 j81 j82 j83; do
 RenderOne $POLY
done
# Johnson solids: elementary polyhedra
echo "\*\*\* Johnson solids: elementary polyhedra \*\*\*"
for POLY in j84 j85 j86 j87 j88 j89 j90 j91 j92; do
 RenderOne $POLY
done
echo "$(date +%H:%M:%S) Job finished"

```