Submitted by Lupine on Sun, 01/10/2010 - 21:14
I write a LOT of scripts for automated processes, and typically I use cron for the automation. I was noticing that some of my scripts were not acting they way I thought they would. Come to find, it was because cron, by default, doesn't read any your ENV variables the same as your normal scripts would if launched from a logged in terminal. Well, there is a simple way around this issue. Just put this at the top of you script:
#!/bin/sh -l
...that tells bash to read in the /etc/profile and ~/.bash_profile files.