Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our application. I'm looking for suggestions on how to stop or remove the last line/carriage return. Any suggestions are appreciated. Thanks!
Here is the current script:
echo "Creating DATES file. `date +"%m-%d-%Y_%H:%M:%S"`"
outdir=/test/iofiles
# 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
typeset -Z2 dmonth dday
month=`date +%m`
year=`date +%y`
((pmonth=month-1))
rm $outdir/date.txt
day=1
while((day<(lasts[pmonth])+1)) ; do
dday=$day
dmonth=$pmonth
echo ${dmonth}/${dday}/${year} >> $outdir/date.txt
((day=day+1))
done
echo "DATES file created. `date +"%m-%d-%Y_%H:%M:%S"`"