In RHEL5.4, the following entries in the crontab works:
* * * * * set >/tmp/set.output
* * * * * . my_env && cat my_env >/tmp/deleteme
The file my_env is placed under my home directory with mode 644 owned by me. The file /tmp/set.output and /tmp/deleteme are created as expected.
However the same entries and the same setup doesn't work in RHEL6.4. It doesn't create or write to /tmp/deleteme although I have permission to create files and write to them in /tmp.
The man page says `source` will look for my_env from the PATH. On non-posix shell, the home directory is searched as well. So RHEL6.4 is correct. I wonder if this is an intended improvement or is it something else that makes the behaviour different?
RHEL5.4:
Code:
$ cat /tmp/set.output
BASH=/bin/sh
BASH_ARGC=()
BASH_ARGV=()
BASH_EXECUTION_STRING='set >/tmp/set.output'
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="2" [2]="25" [3]="1" [4]="release" [5]="x86_64-redhat-linux-gnu")
BASH_VERSION='3.2.25(1)-release'
DIRSTACK=()
EUID=5111
GROUPS=()
HOME=/var/hello
HOSTNAME=hello
HOSTTYPE=x86_64
IFS='
'
LOGNAME=hello
MACHTYPE=x86_64-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/bin:/bin
POSIXLY_CORRECT=y
PPID=27700
PS4='+ '
PWD=/var/hello
SHELL=/bin/sh
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=1
TERM=dumb
UID=5111
USER=hello
_=/bin/sh
RHEL6.3:
Code:
$ cat /tmp/set.output
BASH=/bin/sh
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING='set >/tmp/set.output'
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="1" [2]="2" [3]="1" [4]="release" [5]="x86_64-redhat-linux-gnu")
BASH_VERSION='4.1.2(1)-release'
DIRSTACK=()
EUID=5104
GROUPS=()
HOME=/home/hello
HOSTNAME=hello
HOSTTYPE=x86_64
IFS='
'
LOGNAME=hello
MACHTYPE=x86_64-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/bin:/bin
POSIXLY_CORRECT=y
PPID=23161
PS4='+ '
PWD=/home/hello
SHELL=/bin/sh
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=1
TERM=dumb
UID=5104
USER=hello
_=/bin/sh
I have changed some output to 'hello' for privacy.