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. Testing whether stdout is a terminal is a more reliable test than seeing whether PS1 happens to be set. On Sat, Apr 10, 2021 at 06:59:21PM +0000, Lee wrote: > Can you give an example of profiles that scribble to stderr during > login breaking things like scp? I've tried to create that situation, > but can't. Maybe you're right. I haven't touched that stuff in many years, so I might be repeating outdated advice, or I might have been making incorrect assumptions all along.