myenv.sh script sets LOG_DIR variable.
I can run the script and echo the variable in a single line as:
# First set LOG_DIR to some dummy 'NONE' value
[ysrini@linuxapp01a ~]$ export LOG_DIR="NONE"
[ysrini@linuxapp01a ~]$ echo ${LOG_DIR}
NONE
[ysrini@linuxapp01a ~]$ cat /tmp/bin/myenv.sh
export LOG_DIR="/tmp/log"
#The below command doesn't show the value from myenv.sh
[ysrini@linuxapp01a ~]$ /tmp/bin/myenv.sh; echo ${LOG_DIR}
NONE
# using dot and space works
[ysrini@linuxapp01a ~]$ . /tmp/bin/myenv.sh; echo ${LOG_DIR}
/tmp/log
Now I want to run the above command as another user, let's say the other user is 'ysrini' itself
#First set LOG_DIR to some dummy 'NONE' value
[ysrini@linuxapp01a ~]$ export LOG_DIR="NONE"
[ysrini@linuxapp01a ~]$ echo ${LOG_DIR}
NONE
[ysrini@linuxapp01a ~]$ su - ysrini -c ". /tmp/bin/myenv.sh; echo ${LOG_DIR}"
Password:
NONE
Why is the command ". /tmp/bin/myenv.sh; echo ${LOG_DIR}" output /tmp/log without 'su' and NONE with 'su'?
Thanks,
-srinivas y.