You are not logged in.
Hello all,
First of all, i might be posting this on the wrong place, so if that's the case, sorry about that ... It's my first post here.
I have a script to run that at some given point executes a command in another user's space. I am issuing
su -l -c "some command" user
The problem is that the command I am running depends on environment variables that are set on ~user/.profile. (NOTE: I have no .bash_profile on ~user)
What I expected according to the man pages was that su sourced the ~/.profile, but that is clearly not happening. I tried with .bash_profile or /etc/profile with the same result.
This just happens when i do
'su -l -c'
If I do just
su -l
the /.profile is sourced correctly, but this does not help me during the script.
Right now i am thinking this might be something Arch related, since I have done this on other distros with no problems.
Can anyone help me ?
Tanx,
Offline
you could try
su -l -c '/bin/bash -i -c "some command"' user
as su does not seem to have the -i flag.
Last edited by Trilby (2012-04-01 12:26:54)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Nope, sorry ...
Still the same. No ~/.profile sourced.
The -l (or just -) option on su ought to do it ... it invokes a login shell which should source /etc/profile and .bash_profile or .profile, whichever is present.
Tanx anyway ...
Offline