Re: starting /bin/ksh

John McCue <[email protected]> Fri, 10 Jul 2026 16:46:22 -0400
Newsgroups gmane.os.netbsd.general
Message-ID <[email protected]>
On Fri, Jul 10, 2026 at 03:55:02PM -0400, Todd Gruhn wrote:
>So 'echo $SHELL' tells me that both accts are /bin/ksh
>If I want a cool prompt (PS1) I need to do
>'. ./.kshrc' .  Why? Should this automatically be read
>when I login??

You should check out the manual for these shells :)

ksh may use different startup files than sh(1), ksh(1) uses
~/.profile and depending on what is in .profile, it will read
~/.kshrc.  IIRC ~/.shrc is used by sh(1)

HTH

>
>On Fri, Jul 10, 2026 at 3:44?PM Todd Gruhn <[email protected]> wrote:
>>
>> I thing I found a prob:
>>
>> In /etc/shrc , there is a line that sets PS1 (I am hacking on that).
>> Is it possible to chance or remove that? Comment out?
>>
>> I have PS1 set in .kshrc ...
>>
>> On Fri, Jul 10, 2026 at 2:06?PM Steve Rikli <[email protected]> wrote:
>> >
>> > On Fri, Jul 10, 2026 at 12:15:38PM -0400, Todd Gruhn wrote:
>> > > I checked /etc/passwd :
>> > > root:*: . . .:/bin/ksh
>> >
>> > That indicates your root login is already using ksh, so that's the shell
>> > you'll be in if you su, eg.
>> >
>> > $ su
>> > Password:
>> > # echo $SHELL
>> > /bin/ksh
>> >
>> > > In /root ; dont have .ksh ; need to make that?
>> >
>> > You don't strictly need .kshrc just to use ksh; that file (and others)
>> > is used to customize the shell settings and behavior to your taste. Note
>> > that ksh will also source ~/.profile and the system-wide /etc/profile
>> > files. The man page can help explain the behavior.
>> >
>> > I haven't regularly used Ksh in quite a while but it's not hard to find
>> > docs and examples online about Ksh and .kshrc along with the default
>> > NetBSD ksh(1) man page.
>> >
>> > On Fri, Jul 10, 2026 at 12:17:53PM -0400, Todd Gruhn wrote:
>> > > IN /etc/passwd.BAK :
>> > > root:*: ... /bin/sh
>> > >
>> > > Did I mess this up?
>> >
>> > No. /etc/passwd.BAK is presumably a backup copy of /etc/passwd. It's not
>> > typically used in normal activity.
>> >
>> > If you didn't create it yourself you may want to compare them JIC, eg.
>> >
>> > diff /etc/passwd.BAK /etc/passwd
>> >
>> > If this is a system someone else setup, they may have simply made a copy
>> > before changing things.
>> >
>> >
>> > > On Thu, Jul 9, 2026 at 11:47?PM Steve Rikli <[email protected]> wrote:
>> > > > On Thu, Jul 09, 2026 at 10:44:04PM -0400, Todd Gruhn wrote:
>> > > > > So, I start NetBSD or su to root, I
>> > > > > need to do ' . ./.ksh'.
>> > > > >
>> > > > > Why cant I get /bin/ksh when I login?
>> > > > >
>> > > > > I found /etc/shrc. Does this have something
>> > > > > to do with this? Make a /etc/kshrc ?
>> > > >
>> > > > Are you saying you want to login or su as root and you want the shell
>> > > > to automatically be ksh?
>> > > >
>> > > > Before making any changes, you can check your system's root user shell
>> > > > by looking at root's line in /etc/passwd .
>> > > >
>> > > > $ grep ^root: /etc/passwd
>> > > > root:*:0:0:Charlie &:/root:/bin/sh
>> > > >
>> > > > If you really want to change this, one method is running the NetBSD
>> > > > 'sysinst' command as root, navigate to "Config menu", then "Root shell",
>> > > > and select the shell you prefer.
>> > > >
>> > > > There's no need to create /etc/kshrc to use ksh as a login shell, or
>> > > > to run it manually from the commandline.
>> > > >
>> > > > E.g. if you want to temporarily switch shells from the commandline, you
>> > > > should be able to simply type '/bin/ksh'.

-- 
[t]csh(1) - "An elegant shell, for a more... civilized age."
                         - Paraphrasing Star Wars