On Mon 12 Apr 2021 at 11:26:49 (-0400), Greg Wooledge wrote: > On Mon, Apr 12, 2021 at 10:18:19AM -0500, David Wright wrote: > > I'm not using PS1 to test whether stdout is a terminal, but whether > > the file is running interactively. From man bash: > > > > "PS1 is set and $- includes i if bash is interactive, allowing a > > shell script or a startup file to test this state. > > The second half of that sentence is referring to the $- part. That's > what you're supposed to test to see whether the shell is interactive. > > # bash > if [[ $- = *i* ]]; then > echo "I am an interactive shell" > fi > > # sh > case $- in > *i*) echo "I am an interactive shell" ;; > esac
Thanks for going to the trouble of typing that for us (which you obviously did, as there was a typo). I've made the change here, and it will propagate to my other machines. I see the logic of using a ro option. Cheers, David.