Hi gang, I have the following code inside a the file script.sh
#!/bin/bash
todaysdate=$(date --date='7 day' +'%d')
todaysmonth=$(date +'%m')
todaysyear=$(date +'%Y')
yahoodatestring=$todaysyear$todaysmonth$todaysdate
nicedate=$(date --date='5 day' +'%A')
nice="$nicedate, $todaysmonth/$todaysdate"
dubdub='http://biz.yahoo.com/research/earncal/'
dothtml='.html'
url=$dubdub$yahoodatestring$dothtml
echo $yahoodatestring;
echo $url;
#wget -O thefile.html $url
sed -n "/align=center>/,/<\/small>/p" thefile.html > step1.html
sed -n "/<td>/,/<\/td>/p" step1.html > step2.html
sed -n '/N\/A/{s/.*//;x;d;};x;p;${x;p;}' step2.html | sed '/^$/d' > step3.html
sed -n "/\">/,/<\/a>/p" step3.html > step4.html
grep 'finance.yahoo' step4.html > step5.html
sed 's/.\{12\}$//' step5.html > step6.html
rev step6.html | cut -c -7 | rev > step7.html
cut -d '>' -f2 step7.html > step8.html
php yahoo-pull.php > email.html
tail -n+2 email.html > email2.txt
mail -s "$(echo -e 'Companies Reporting On $nice\nContent-Type: text/html')" email@gmail.com < email2.txt
when I run ./script.sh in the command line, it runs fine and I receive an email to my inbox with the script output. However, when I try to schedule it as a cron, I get an email that says
"Content-type: text/html No input file specified."
To summarize, when the script is run in the command line manually it works, but when it is in cron, I get "Content-type: text/html No input file specified."
Does anybody have any ideas why this happens?