[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bsdi-users
Subject:    Re: PS1 prompt changes when I do su -m
From:       jparnas () javanet ! com
Date:       2000-04-27 13:44:57
[Download RAW message or body]


It sounds like what is happening is a new shell is being run and while
bash is still run, it may run root's startup file (ie, /root/.bashrc,
/etc/profile, ...).  

When a new shell is created (as is always done with su, I think, it starts
with the default and if a local for the user exists, it reads the local
startup file.  I think the -m option of su makes is the environment (you can
look at it with the printenv command) is not changed, and you go use the
caller's shell (but a new instance thereof).  If you're the only bash user
that is the superuser, you can just edit the /root/.bashrc file, and all
should be ok if you put in the change(s) you want.  If it's shared, you
have to differentiate instances of you calling it from those of others.
To do this you can use the $LOGNAME variable, which I think will remain 
what you logged in as even after an su -m.  I think the $USER environment
varirable will stay the same too, but you can test it.

In BSDI, at least, su -m does start another shell.  You can test this by
echoing $$ before and after the su (at least with tcsh -- I don't know
bash). su's -m option has one use the same shell as the
caller and things like $HOME remain the same (mine stays as /u/jparnas
instead of /root if I don't use the -m option).  

To see more details, you could use ktrace to see what happens with su -m
vs. the normal su or look at the source if you want.

Hope this helps, 

Jacob
- ---
In message <Pine.BSI.4.21.0004241820530.10381-100000@mail.postalzone.com>you wr
ite:
>I want my prompt to stay the same when I do a "su -m" (like it does on my
>Debian Gnu/Linux Slink system).
>
>When I do a 'su -m", I receive a new prompt that shows
>
>su-2.02# echo $PS1
>\s-\v\$
>
>I can't find any configuration files that have this new setting. How can I
>get it to just stay with:
>\h:\w $PSCH
>
>(Since I am using the -m option to su, I am thinking that no config files
>should be read -- environment is unmodified.)
>
>As you can probably tell, I am using Bash 2.02 (under BSD/OS 4.0.1).
>
>Does anyone have any suggestions?
>
>Thanks,
>
>Jeremy C. Reed
>-----------------------------------------
>                        IWBC ISP Services
>                             jcr@iwbc.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic