Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Wed, 1 Feb 2017, the wise Robert Elz wrote:


/etc/profile and .profile are read only in login shells.  By default an xterm
won't start its shell that way - you need the -ls option to the xterm, or
have "xterm*loginShell: true" in your X resources.



...


How are you actually connecting/logging in ?


...


If you're using a display managed (xdm or similar) then you'll need to
arrange to either set ENV in its config file (somehow) or set up the
default resources so that the loginShell resource gets set (xterms don't
have a menu entry for this one - it would be useless, the shell gets
started before you would get a chance to use it).


I'm logging in with xdm. Adding "xterm*loginShell: true" in 
.Xdefaults solved the problem.


So thanks for all the help!

Regards,
Marco
--
HOW YOU CAN TELL THAT IT'S GOING TO BE A ROTTEN DAY:
#32: You call your answering service and they've never heard of
 you.


Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Robert Elz
Date:Wed, 1 Feb 2017 19:55:54 +0100 (CET)
From:Marco Beishuizen 
Message-ID:  

  | "set -o emacs" is in my .shrc, so I thought this would do the trick.

Can you confirm that if you actually type that in the sh then editing
works as it should ?

This will allow us to concentrate upon solving the real problem,
and forget about arrow key mappings, and such ...

  | Hey, this does something! So it looks like my .shrc isn't read at all. 

That seems likely.

  | There is a line "export ENV="$HOME/.shrc" in .profile, but that doesn't 
  | seem to be read at startup either.

/etc/profile and .profile are read only in login shells.  By default an xterm
won't start its shell that way - you need the -ls option to the xterm, or
have "xterm*loginShell: true" in your X resources.

Perdonally I just forget .profile, and have ENV set before the xterrm gets
started, and in the environment, so it just gets passed down to the shell.

  | So how to get .shrc and .profile to be read at login?

How are you actually connecting/logging in ?

If you're on the console, and logging in on either /dev/console or
/dev/ttyE? then the getty that does the login sequence, via login, should
make the shell that gets started that way a login shell, and the profile
files will be read.

If you're using a display managed (xdm or similar) then you'll need to
arrange to either set ENV in its config file (somehow) or set up the
default resources so that the loginShell resource gets set (xterms don't
have a menu entry for this one - it would be useless, the shell gets
started before you would get a chance to use it).

If you're using ssh I think starting a login shell should be the default,
and .profile should just get read ... if you're not connecting that way,
perhaps enable sshd and try it, and see if things work then.

kre



Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Wed, 1 Feb 2017, the wise Christos Zoulas wrote:


That's good, it is the standard ansi sequence for right arrow.

In shell type:

$ set -o emacs
$ xbind

Do you see the arrow key bindings?


It seems that the users .shrc and .profile are not being read at 
login because after entering "set -o emacs" history does show.


So how to force .shrc and .profile being read at login?

Regards,
Marco

--
By the time you swear you're his,
shivering and sighing
and he vows his passion is
infinite, undying --
Lady, make a note of this:
One of you is lying.
-- Dorothy Parker, "Unfortunate Coincidence"


Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Wed, 1 Feb 2017, the wise Robert Elz wrote:

As long as that was from the right arrow key, that's fine (up arrow, the 
most relevant for getting started with cmd line editing should have A 
instead of C)


Yes indeed it was the right arrow key :).

I got your off-list message, not terribly useful, mostly because I had a 
brain fade, and asked for the wrong stuff ...


But in that you didn't have editing enabled (no "set -o emacs" or "set 
-o vi") or if you had attempted one of those, it didn't work.


"set -o emacs" is in my .shrc, so I thought this would do the trick.

Make sure you've done that (or the equiv "set -E" or "set -V" (which to 
use depends whether you prefer emacs (ugh!) or vi (yay) editing 
commands...)


Then try
fc -l and verify that it lists the commands that you have entered.


Hey, this does something! So it looks like my .shrc isn't read at all. 
There is a line "export ENV="$HOME/.shrc" in .profile, but that doesn't 
seem to be read at startup either.


So how to get .shrc and .profile to be read at login?

--
God is a comic playing to an audience that's afraid to laugh.


Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Robert Elz
Date:Wed, 1 Feb 2017 18:01:59 +0100 (CET)
From:Marco Beishuizen 
Message-ID:  

  | This gives:
  | ^[[C

As long as that was from the right arrow key, that's fine (up arrow,
the most relevant for getting started with cmd line editing should have
A instead of C)

I got your off-list message, not terribly useful, mostly because I had
a brain fade, and asked for the wrong stuff ...

But in that you didn't have editing enabled (no "set -o emacs" or "set -o vi")
or if you had attempted one of those, it didn't work.

Make sure you've done that (or the equiv "set -E" or "set -V" (which to use
depends whether you prefer emacs (ugh!) or vi (yay) editing commands...)

Then try
fc -l
and verify that it lists the commands that you have entered.

kre



Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Christos Zoulas
On Feb 1,  6:01pm, mb...@xs4all.nl (Marco Beishuizen) wrote:
-- Subject: Re: /bin/sh command history in NetBSD/i386

| On Wed, 1 Feb 2017, the wise Christos Zoulas wrote:
| 
| > See what the arrow key prints:
| >
| > $ hexdump -C
| > 
| > ^D
| 
| This gives:
| ^[[C

That's good, it is the standard ansi sequence for right arrow.

In shell type:

$ set -o emacs
$ xbind

Do you see the arrow key bindings?

christos


Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Wed, 1 Feb 2017, the wise Christos Zoulas wrote:


See what the arrow key prints:

$ hexdump -C

^D


This gives:
^[[C


--
You're already carrying the sphere!


Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Christos Zoulas
In article ,
Marco Beishuizen   wrote:
>-=-=-=-=-=-
>
>On Wed, 1 Feb 2017, the wise Cág wrote:
>
>> It is strange because it works here and is what the man page recommends. 
>> Did you log out of all sessions?
>
>Yes, did log out all sessions. Even after a reboot no change.

See what the arrow key prints:

$ hexdump -C

^D


christos



Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Wed, 1 Feb 2017, the wise Cág wrote:

It is strange because it works here and is what the man page recommends. 
Did you log out of all sessions?


Yes, did log out all sessions. Even after a reboot no change.

--
Yes, we will be going to OSI, Mars and, Pluto, but not necessarily in
that order.
-- George Michaelson

Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Wed, 1 Feb 2017, the wise Stephen Borrill wrote:


What's your terminal type?

echo $TERM


Both root and user are xterm.

--
If your sexual fantasies were truly of interest to others, they would no
longer be fantasies.
-- Fran Lebowitz


Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Stephen Borrill

On Wed, 1 Feb 2017, Marco Beishuizen wrote:

On Tue, 31 Jan 2017, the wise C??g wrote:

Try "set -o vi" or "set -o emacs" and "export ENV="$HOME/.shrc" in 
.profile.


Unfortunately these didn't make any difference.


What's your terminal type?

echo $TERM

--
Stephen

Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Cág
Marco Beishuizen wrote:

> Unfortunately these didn't make any difference.

It is strange because it works here and is what the
man page recommends. Did you log out of all
sessions?


Cág



Re: /bin/sh command history in NetBSD/i386

2017-02-01 Thread Marco Beishuizen

On Tue, 31 Jan 2017, the wise Cág wrote:

Try "set -o vi" or "set -o emacs" and "export ENV="$HOME/.shrc" in 
.profile.


Unfortunately these didn't make any difference.

Regards,
Marco

--
Real Users find the one combination of bizarre input values that shuts
down the system for days.

Re: /bin/sh command history in NetBSD/i386

2017-01-31 Thread Cág
Marco Beishuizen wrote:

> Does anyone have an idea how to get the same
> behaviour of /bin/sh for the users as root has?

Hi,

Try "set -o vi" or "set -o emacs" and
"export ENV="$HOME/.shrc" in .profile.

man 1 sh has some info in the Argument List
Processing and the Command Line Editing
sections.


Cág



Re: /bin/sh command history in NetBSD/i386

2017-01-31 Thread Christos Zoulas
In article ,
Marco Beishuizen   wrote:
>Hi,
>
>I recently installed NetBSD 7.0.2 on an old laptop (i386). Both root and 
>the user have /bin/sh as the (default) shell, but only root has a command 
>history, using the arrow keys. I've also installed NetBSD on a DEC/Alpha 
>but there is no problem and history works out of the box for the user.
>
>After trying different sh config files in the user's home 
>directory (/etc/shrc, /etc/profile, /root/.shrc, /root/.profile, 
>/.profile) nothing works.
>
>Does anyone have an idea how to get the same behaviour of /bin/sh for the 
>users as root has?
>

set -o emacs ?

christos