On Fri, Sep 18, 2020 at 10:26 AM Ottavio Caruso <ottavio2006-usenet2...@yahoo.com> wrote: > On 18/09/2020 09:01, Tom H wrote: >> On Thu, Sep 17, 2020 at 3:16 PM Ottavio Caruso >> <ottavio2006-usenet2...@yahoo.com> wrote: >>> On 17/09/2020 10:40, Tom H wrote:
>>>> You've said that you're now sourcing "$HOME/.kshrc" if >>>> "SKSH_VERSION" exists. >>>> >>>> You could add the sourcing of "$HOME/.shrc" if "$SH_VERSION" >>>> exists. >>>> >>>> Or you could export ENV and use a case-esac of this kind: >>>> >>>> case "$0" in >>>> *ksh) >>>> ... >>>> PS1='\u@\h:\w\$ ' >>>> ;; >>>> *sh) >>>> ... >>>> PS1='${USER}@${HOST}:${PWD}\$ ' >>>> ;; >>>> esac >>> >>> This solves the problem. Thanks. >> >> You're welcome. >> >> But, out of curiosity, which option did you choose? TIA > > Ah sorry, I used the second option. > > I have this in .profile: > > export ENV="$HOME/.kshrc" > > and this in .kshrc: > > case "$0" in > *ksh) > PS1='\u@\h:\w\$ ' > ;; > *sh) > PS1='${USER}@${HOST}:${PWD}\$ ' > ;; > esac OK. Thanks. > On my NetBSD VM, sh and ksh are two different executables. ENV points > to ~/.shrc which then sources ./.kshrc if KSH_VERSION = true > > I have thought of replicating the same configuration over to OpenBSD > but I might be looking for trouble. I use the same dotfiles on OpenBSD and NetBSD (I therefore don't use OpenBSD's ksh backslash-escaped variables). > On a side note, there's no mention of startup files in sh(1) and I > wonder why. Because POSIX sh doesn't define startup files, only "ENV". 4.2BSD sh, on the other hand, read "$HOME/.profile" (only) in login mode, but didn't read "ENV" in interactive mode.