Re: interactive shell detection in shrc

2024-09-23 Thread Steffen Nurpmeso
Valery Ushakov wrote in : |On Tue, Sep 24, 2024 at 00:06:22 +0700, Robert Elz wrote: | |> Date:Mon, 23 Sep 2024 12:16:10 +0300 |> From:Valery Ushakov |> Message-ID: |> |>| I'd like to switch this to the "early return" style, something like |>| |>| # the res

Re: interactive shell detection in shrc

2024-09-23 Thread Valery Ushakov
On Tue, Sep 24, 2024 at 05:01:18 +0700, Robert Elz wrote: > | sh .shrc allows you to check that .shrc has no failures, but you cannot > | test how it affected the shell (as opposed to sourcing it). > > That's the point, to test what would happen if it were sourced, > to prevent undesired acti

Re: ed(1) as default editor in sh(1)

2024-09-23 Thread Greg Troxel
I too am ok with ed(1), which is IIRC what you had in Sixth Edition before the newfangled ex/vi showed up. I actually prefer it as simpler. These days, I tend to ed(1) for really quick things or bad situations, and emacs for everything else. What I find broken is that various programs have EDITO

ed(1) as default editor in sh(1)

2024-09-23 Thread tlaronde
In commit 684f0c282018583d8983ab6b3218c03da6841159, uwe writes: TBH, I was a bit incredulous, but sh's own fc _does_ use ed if EDITOR is not set, though it seems to be the only program in base to do this. Speak of a self-fulfilling prophecy... IMHO, sh(1) is right here. E

Re: interactive shell detection in shrc

2024-09-23 Thread Robert Elz
Date:Tue, 24 Sep 2024 00:10:24 +0300 From:Valery Ushakov Message-ID: | shrc is there to affect the state of a shell in a | way that is visible in subsequent use of that same shell. Of course. | sh .shrc allows you to check that .shrc has no failures, but you

Re: ed(1) as default editor in sh(1)

2024-09-23 Thread Valery Ushakov
On Mon, Sep 23, 2024 at 22:59:42 +0200, tlaro...@kergis.com wrote: > In commit 684f0c282018583d8983ab6b3218c03da6841159, uwe writes: > > TBH, I was a bit incredulous, but sh's own fc _does_ use ed if EDITOR > is not set, though it seems to be the only program in base to do > thi

Re: interactive shell detection in shrc

2024-09-23 Thread Valery Ushakov
On Tue, Sep 24, 2024 at 00:06:22 +0700, Robert Elz wrote: > Date:Mon, 23 Sep 2024 12:16:10 +0300 > From:Valery Ushakov > Message-ID: > > | I'd like to switch this to the "early return" style, something like > | > | # the rest of the file is for interactive she

Re: interactive shell detection in shrc

2024-09-23 Thread Robert Elz
Date:Mon, 23 Sep 2024 12:16:10 +0300 From:Valery Ushakov Message-ID: | I'd like to switch this to the "early return" style, something like | | # the rest of the file is for interactive shells only | case "$-" in *i*) ;; *) return ;; esac I think the primary

interactive shell detection in shrc

2024-09-23 Thread Valery Ushakov
Our skel files use case "$-" in *i*) # interactive mode settings go here ;; esac which, IMO, is horrible for readability/usability as it suggests that you add your changes to your shrc nested inside a case. I'd like to switch this to the "early return" style, something like #