bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with bash


From: Chet Ramey
Subject: Re: problem with bash
Date: Mon, 27 Oct 2003 15:51:19 -0500

> I've a user  test  that has a /bin/bash shell. In his .profile file 
> there is these lines:
> ODSRELEASE=/some/dir/
> export ODSRELEASE
> 
> When, as user root, I try this command:
> 
> #su - test -c "echo $ODSRELEASE"
> or
> #su - test -c 'echo $ODSRELEASE'
> or
> #su - test -c "echo \$ODSRELEASE"
> 
> this command don't return any value.
> I've also pasted .profile lines in .bashrc and .bash_profile but the 
> result is the same.
> 
> If I turn the shell to ksh, then:
> #su - test -c 'echo $ODSRELEASE'
> return:
>  Sun Microsystems Inc.   SunOS 5.8       Generic February 2000
>  /some/dir/
> 
> I think that the profile of a user that has a bash shell isn't loaded.  
> It's correct? If the answer is Yes, why?

Bash doesn't run the login shell startup files unless the shell is interactive
or the `--login' flag is supplied.

If you want to have bash run login shell startup files even when the shell is
not interactive, you need to recompile with NON_INTERACTIVE_LOGIN_SHELLS
defined in config-top.h.

Bash does look for `-su' and `su' in argv[0] and runs the login shell or other
startup files, respectively.  The Solaris 8 `su' doesn't do things that way.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]