I am new to scheduling tasks with cron and crontab. I am trying to schedule execution of a task as if I had logged on, opened a terminal, and executed it myself.
Ho
crontab is not a bash script, you can't use environment variables that are normally available in a shell.
Try moving all that code into a shebang'ed script file (one starting with the line "#!/bin/bash") and run that script in the crontab.
I'm not sure, but i think PATH (and maybe EMAIL if you set it) may be the only one you can access inside the crontab file .
EDIT: Check the crontab 5 man page, there quite a few environment variables aviable, all set by the cron daemon.