No logro solucionar sacar el dia de la semana de una fecha dada.

Con este c�digo pretendo sacar el dia de la semana dada una fecha como parametro
por ejemplo.

./dia 27 10 2009
El resultado saliera:
Martes

El problema es que cuando llego casi al final el lunes etsa representado por un 0. el martes por 1.. y quiero hacer un bucle if para sustituir el 0 por Lunes
de este modo

if [$dow -eq 0] then
echo -"Lunes"
else
fi

Pero todo el rato me da error
y no se porque.
�Alguien me podria ayudar?
Gracias

#!/bin/sh

# ja fe ma ap ma ju ju ag se oc no de
set -A lasts 0 31 28 31 30 31 30 31 31 30 31 30 31

dia=$1
mes=$2
anyo=$3

#
# Get Day of Week of Jan 1
dow1=$(cal 1 $anyo | sed -n '3s/. //gp')
((dow1=7-dow1))

#
# Es a�o Bisiesto?
leap=0
if ((!(anyo%100))); then
((!(anyo%400))) && leap=1
else
((!(anyo%4))) && leap=1
fi

#
# Establecer numero de dias de Febrero
lasts[2]=28
((leap)) && lasts[2]=29

#
# calculate day of year
i=0
previous=0
while ((i < mes)) ; do
((previous=previous+lasts[i]))
((i=i+1))
done
((doy=previous+dia))

#
# Calculate day of week
((dow = (doy+dow1-1)%7 ))

#echo dow = $dow
echo diadelasemana=$dow

if [$dow -eq 0] then
echo -"Lunes"
else
echo "..ya seguiria con cada numero"
fi

exit 0

---------- Post updated at 08:17 AM ---------- Previous update was at 08:10 AM ----------

Sorry i didn't realize that I had to write in English

My problem is that i want to calculate the day of the week, i want to change result given as a number for the day.

I mean, the program now do that if the day is Monday is represented by 0, Tuesday by 1.. but i want the word "Monday" as a result. I thought in a bucle if but there is always a mistake and i dont know why.

Thank you

please write a new post in english and please use CODE tags!

thank you