su - user -c 'command' behaves differently

I notice that su - user (note with dash) brings in more of the user's environment than does su - user -c 'command'. For example, if root does an su - user, and types "umask" to the prompt, one umask is displayed; yet, if instead the command is su - user -c 'umask', the value is different. I thought that if the - were used in the su command, that all of the new user's environment would be there- what am I missing? (This is HP-UX, by the way)

Hi,
it depends on what shell You use, but in bash, "su - user" alone gives You an interactive shell. But the "-c" option (and some others I think) actively creates a non-interactive shell, because it reads commands from a file (more or less). Depending on shell, different resource files are read and hence different environments.

/Lakris

Thanks for the info; would you happen to know of any way to force it to behave the same way as if the user logged in? Right now I have to guess at the files to explicitly source in to "fool it". Thanks again