[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: .profile not being src'd at login on uptodate buster



On Sat 10 Apr 2021 at 15:21:57 (-0400), Greg Wooledge wrote:
> On Sat, Apr 10, 2021 at 01:21:21PM -0500, David Wright wrote:
> > My start-up files, .bash_profile, .bashrc, and other files that
> > they source, contain permanent printf commands. When they finish
> > printing their output, the next thing that's going to happen is
> > that the shell will emit a prompt. So there's a certain elegance
> > in using that very prompt as the condition.
> > 
> > The thread, and my comment, was about the topic under discussion,
> > startup files, not scripts in general. Using PS1 as a condition
> > in the latter is unlikely to make much sense at all.
> 
> I'm not a fan of it, because I actually like to export PS1, rather
> than setting it in .bashrc every time.  I may be in the minority there.

Exported from .[bash_]profile? I don't do that because the terminal
type might be different (login on VC, but prompt in an xterm).

Exported from .bashrc? I'm not sure of the benefits.

> Testing whether stdout is a terminal is a more reliable test than seeing
> whether PS1 happens to be set.

But you do actually lose the distinction between sourcing the file
and executing it. Only the former has PS1 set, whereas both have
stdout to a terminal.

Cheers,
David.


Reply to: