I installed bash and have been trying to set up my prompt. I notice
that if I add
PS1='# '; export PS1
to my .profile, then I get the prompt when I log in, not when I /sudo
su/ from a regular user. If I add
PS1='# '; export PS1
to ~/.bashrc, then I get the prompt when I ``sudo su'', but not when I
log in. I can add the prompt set up to both files, but I'm asking myself---how do you guys avoid such redundancy? (Thanks!)
On 02/12/2024 at 11:32, Wolfgang Agnes wrote:
I installed bash and have been trying to set up my prompt. I notice
that if I add
PS1='# '; export PS1
to my .profile, then I get the prompt when I log in, not when I
/sudo
su/ from a regular user. If I add
PS1='# '; export PS1
to ~/.bashrc, then I get the prompt when I ``sudo su'', but not when
I
log in. I can add the prompt set up to both files, but I'm asking
myself---how do you guys avoid such redundancy? (Thanks!)
Put it in .bashrc and then call .bashrc from .profile (unless
.bash_profile exists; only for bash.)
Chris Elvidge <[email protected]> writes:
On 02/12/2024 at 11:32, Wolfgang Agnes wrote:
I installed bash and have been trying to set up my prompt. I notice
that if I add
PS1='# '; export PS1
to my .profile, then I get the prompt when I log in, not when I
/sudo
su/ from a regular user. If I add
PS1='# '; export PS1
to ~/.bashrc, then I get the prompt when I ``sudo su'', but not when
I
log in. I can add the prompt set up to both files, but I'm asking
myself---how do you guys avoid such redundancy? (Thanks!)
Put it in .bashrc and then call .bashrc from .profile (unless
.bash_profile exists; only for bash.)
Is this how it's typically done? I thought that sourcing .profile, say,
from .bashrc would destroy the purpose of having a separate thing for
when logging in and another for interactive runs of the shell. Now
realize I could make a library-script and source it from both scripts (.profile and .bashrc), but then I've never done that myself and so I
was wondering how people do things.
Anyway, thanks very much for sharing your side of things!
I installed bash and have been trying to set up my prompt. I notice
that if I add
PS1='# '; export PS1
to my .profile, then I get the prompt when I log in, not when I /sudo
su/ from a regular user. If I add
PS1='# '; export PS1
to ~/.bashrc, then I get the prompt when I ``sudo su'', but not when I
log in. I can add the prompt set up to both files, but I'm asking myself---how do you guys avoid such redundancy? (Thanks!)
How you do this depends on how you use your shells. There
are "interactive" shells, and "login" shells
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 22:55:36 |
| Calls: | 12,105 |
| Calls today: | 5 |
| Files: | 15,006 |
| Messages: | 6,518,139 |