date >> /tmp/shell.log
echo $# >> /tmp/shell.log
echo $* >> /tmp/shell.log
export JAVA_HOME=/usr/local/jre1.6
PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:poi-3.8-20120326.jar:dom4j-1.6.1.jar:ooxml-schemas-1.0.jar:poi-ooxml-3.5-FINAL.jar:xmlbeans-2.3.0.jar:$CLASSPATH
if [ $# == 3 ]
then
	java Planilha $1 $2 $3 > $4
else
# 1 = r | w
# 2 = arq lote
# 3 = planilha
# 4 = arq saida
# 5 = s | n - formatar
	java Planilha "$1" "$2" "$3" "$4" "$5"
fi
