#! /bin/sh
#
# This is an example of a useful executable mission
# I recommend you stay away from using shells other than 'sh' just to make
# sure that you can give this to someone else (IE, it's standard UNIX).
#
# $$.temp evaluates to <processid>.temp (it should be unique)
#
cat << EOF > /tmp/$$.temp
level = {
  author = "Aaron Hightower"
  numlives = #numlives
  name = "#name"
  rock = {
    count = 8
    scale = .10
    geometry = "#rock1"
    text = "rock #rock1"
    points = ##0
    rock = {
      count = ##
      scale = .08
      geometry = "#rock2"
      text = "rock #rock2"
      points = ##00
      sfxid = 0
      rock = {
	count = ##
	scale = .05
	geometry = "#rock3"
	text = "rock #rock3"
	points = ##000
	sfxid = 0
      }
    }
  }
}
EOF
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
  name="level $i" ;
  count="${i}0" ;
  numlives="0"
  case "$i" in
    '1') numlives="10" ; rock1="foldstar 300 9 0.01" ; rock2="foldstar 300 11 0.01"; rock3="foldstar 300 13 0.01" ;;
    *)
	rock1="aaron" ; rock2="aaron" ; rock3="aaron" ;;
  esac
  cat /tmp/$$.temp | sed "s/#name/$name/;s/#count/$count/;s/##/$i/;s/#rock1/$rock1/;s/#rock2/$rock2/;s/#rock3/$rock3/;s/#numlives/$numlives/"
done
# Make sure if you use this to remove these temporary files
rm -f /tmp/$$.temp
