On Thu, Sep 17, 2020 at 9:33 AM Ottavio Caruso
<ottavio2006-usenet2...@yahoo.com> wrote:
> On 17/09/2020 00:58, Ashlen wrote:
>> On 20/09/15 05:49PM, Ottavio Caruso wrote:
>>>
>>> Maybe it's just because OpenBSD sh is just ksh in disguise or there
>>> might be other reasons that I obviously don't know.
>>
>> Yep, you're right. They share the same inode.
>>
>> ls -li /bin/{,k}sh
>>
>> 77862 -r-xr-xr-x  3 root  bin  613656 Sep 15 12:10 /bin/ksh
>> 77862 -r-xr-xr-x  3 root  bin  613656 Sep 15 12:10 /bin/sh
>>
>> sh(1) also attests to this.
>
> Thanks but I gave that for granted. My question was about not
> exporting PS1 to subshells. In theory, it shouldn't be exported but
> it does get exported if one uses ENV=.kshrc vs sourcing .kshrc.

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

Reply via email to