I cannot figure out why this function gets stuck.
What I am trying to do is create a folder from a predetermined start date up until the present month. Unfortunately it completes all the folder creations then gets stuck with the arithmetic posted below.
Would anyone be able to give me a hint to get on to the right track?
Here is my code:
yearloop(){
year=$(echo "$firstmsgdate"|cut -d"/" -f3)
zmmailbox -z -m $account gf /archive || zmmailbox -z -m $account cf /archive
crntmnth=$(date +"%m")
incmonth=0
while [ $year -le $currentyear ]; do
if [ "$year" -lt "$currentyear" ]; then
#do stuff
let year++
elif [ $year -eq $currentyear ]; then
while [ $incmonth -lt $crntmnth ]; do
#do otherthings
let incmonth++
done
else
echo "Else"
fi
done
}
This is the output I receive
+ '[' 15 -le 15 ']'
+ '[' 15 -lt 15 ']'
+ '[' 15 -eq 15 ']'
+ '[' 2 -lt 02 ']'
+ '[' 15 -le 15 ']'
+ '[' 15 -lt 15 ']'
+ '[' 15 -eq 15 ']'
+ '[' 2 -lt 02 ']'
+ '[' 15 -le 15 ']'