Re: which file should have my bash prompt, .profile vs .bashrc

Liste des GroupesRevenir à cubf misc 
Sujet : Re: which file should have my bash prompt, .profile vs .bashrc
De : lgusenet (at) *nospam* be-well.ilk.org (Lowell Gilbert)
Groupes : comp.unix.bsd.freebsd.misc
Date : 03. Dec 2024, 03:50:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <44frn5lbsv.fsf@be-well.ilk.org>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13)
Wolfgang Agnes <wagnes@example.com> writes:

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, and .bashrc is only invoked
under specific conditions. See the bash manual for details, which
afford even more flexibility than most other shells.

Also note that .profile is read and executed by /bin/sh, should you
invoke that shell, and that on FreeBSD, /bin/sh is *not* bash.

--
Lowell Gilbert, embedded/networking software engineer
http://be-well.ilk.org/~lowell/

Date Sujet#  Auteur
2 Dec 24 * which file should have my bash prompt, .profile vs .bashrc6Wolfgang Agnes
2 Dec 24 +* Re: which file should have my bash prompt, .profile vs .bashrc3Chris Elvidge
2 Dec 24 i`* Re: which file should have my bash prompt, .profile vs .bashrc2Wolfgang Agnes
2 Dec 24 i `- Re: which file should have my bash prompt, .profile vs .bashrc1Chris Elvidge
3 Dec 24 `* Re: which file should have my bash prompt, .profile vs .bashrc2Lowell Gilbert
6 Dec 24  `- Re: which file should have my bash prompt, .profile vs .bashrc1Anton Shepelev

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal