Deutsch English Français Italiano |
<44frn5lbsv.fsf@be-well.ilk.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lowell Gilbert <lgusenet@be-well.ilk.org> Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: which file should have my bash prompt, .profile vs .bashrc Date: Mon, 02 Dec 2024 21:50:40 -0500 Organization: A noiseless patient Spider Lines: 27 Message-ID: <44frn5lbsv.fsf@be-well.ilk.org> References: <874j3ml3q8.fsf@example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 03 Dec 2024 03:50:41 +0100 (CET) Injection-Info: dont-email.me; posting-host="a37c719008e4d59881f4c2169b35089c"; logging-data="3899552"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192smGhLUJTzi/WcDEJgVQv" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:hW0/suDF3WcGTr41MA0OwTrgN54= sha1:iu2f5iXKmbD6bxYpppGqOGVJoo4= Bytes: 1935 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/