I'm having a little trouble finishing up this script any help would be great.
My system is SCO OpenServer Enterprise System (ver 5.0.5m) and i'm using sh
This script checks todays date and goes and downloads a file with yesterdays date in the name.
---start----
Server="ipaddresshere"
usern="usernamehere"
pword="passwordhere"
day=`eval date +%Y%m`
tmp1=`eval date +%d`
num=`eval echo $tmp1 - 1 | bc`
tmp2=$day$num
file=filename_$tmp2.txt
cd /tmp
ftp -i -n $Server <<here
user $usern $pword
binary
cd folder1
cd folder2
get $file
quit
here
exit
---end----
Now my problem is what happens on the first of the month... how do i make this script use the 30th or the 31th on the first of the month.