Dear All
I am running into a situation where I am running a script as another user lets say oracle using su command as below, and the script fails because the .profile of oracle is not executed so the environment variables are not set.
cat /etc/passwd | grep oracle
oracle:!:400:101::/app/oracle:/usr/local/bin/bash
Now, I logegd in as root and did this :
su - oracle -c test.sh
test.sh is
#!/bin/sh
echo "I am here"
env
The output has hello from the echo command but the env does not show any ORACLE variables from .profile of oracle user or even from .bash_profile. I alos verified by adding a simple sqlplus block , it failes with sqlplus not found due to missing environment variables.
Any ideas ?
Thanks in advance !