Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

drobati

macrumors newbie
Original poster
Jun 11, 2009
4
0
When using su admin, the prompt becomes

Code:
bash-3.2$

I had thought thought that perhaps that was because my .bash_profile file in /Users/admin wasn't configured.

I copied over a similar file from my standard account /Users/drobati/.bash_profile

Closed terminal and reopened.

Typed in su admin again and nothing changed.

I'm aware that /etc/profile calls to /etc/bashrc. Unfortunately the variable within /etc/bashrc is PS1='\h:\W \u\$ '

This doesn't equal the prompt im currently getting. This prompt equals '\s-\v\$ '

Where is the $PS1 variable stored when su is used in a standard session? Is there a command that can tell me where $PS1 is being changed?
 
When using su admin, the prompt becomes

Code:
bash-3.2$

I had thought thought that perhaps that was because my .bash_profile file in /Users/admin wasn't configured.

I copied over a similar file from my standard account /Users/drobati/.bash_profile

Closed terminal and reopened.

Typed in su admin again and nothing changed.

I'm aware that /etc/profile calls to /etc/bashrc. Unfortunately the variable within /etc/bashrc is PS1='\h:\W \u\$ '

This doesn't equal the prompt im currently getting. This prompt equals '\s-\v\$ '

Where is the $PS1 variable stored when su is used in a standard session? Is there a command that can tell me where $PS1 is being changed?
When you use the su command to switch users, the prompt you get is the prompt of the user you switched to. Sounds obvious after you realize that this is the case, but it'll trip up UNIX newbies all the time.
 
Use "su -l" or "su -" so it simulates a full login. Otherwise the .bash_profile is not read. If you create a file called ".bashrc" at the root level of the "admin" account, and put the PS1 string in there, it will be read and the defined prompt will be used.

S-
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.