#!/bin/bash

# Test script that runs for some time and writes some files.
# To get started, type:
#   execwrapper $PWD/count 10

if [ $# != 1 ]; then
  echo "Usage: `basename $0` <N>"
  exit 1
fi
N=$1

for ((i = 0; i < $N; i++)); do
  echo $i
  # Note that current directory is the execution directory.
  echo $((i*3)) > out.$i

  # Can write any files to be picked up by the servlet.
  # Important: Use tabs to separate key from value
  echo "i	$i" > count.map
  echo "result	$((i*3))" > count.map
  sleep 1
done
