This isn't the usual problem that a shell script runs from the command line and not the cron. It's a little different.
Among other things, the shell scrip executes my .profile to set a bunch of variables. It then does an env to ensure that it ran OK.
There are echos in the shell script and the .profile. All this gets logged.
The shell script (simplified) looks like this:
echo Start of shell script
echo
.
.
.
/home/me/.profile
echo Results of env =
env
echo
echo End of shell script
The log (simplified) looks like this:
Start of shell script
----------- (these echos are from the .profile)
profile started
variables a b c x y z set
a=yes
b=yes
c=yes
x=yes
y=yes
z=yes
profile ended
------------------------
Results of env =
a=no
b=yes
c=no
--------
end of shell script
I can see from the log that it is executing the correct .profile, however, the variables set in the .profile aren't "retained".
If I change the command to :
. /home/me/.profile
^
Note: added . space
everthing runs fine.
So what's does the . space do that makes it work?