Hi Rudolf, hi Jason, Rudolf Sykora wrote on Wed, May 22, 2019 at 02:34:31PM +0200: > Ingo Schwarze <schwa...@usta.de> writes: >> Rudolf Sykora wrote: >>> after reading the sh man page I have been wondering: >>> When is the line editing mode described just after the >>> 'COMMAND HISTORY AND COMMAND LINE EDITING' heading relevant?
>> Near the beginning, the sh(1) manual page contains this paragraph: >> >> This version of sh is actually ksh in disguise. As such, it also >> supports the features described in ksh(1). This manual page describes >> only the parts relevant to a POSIX compliant sh. If portability is a >> concern, use only those features described in this page. > yes, I was aware of that paragraph. >> In particular, the section "COMMAND HISTORY AND COMMAND LINE EDITING" >> describes only those features of ksh(1) "Vi editing mode" required by >> POSIX. Wo do not provide a shell or an execution mode of ksh >> providing exactly those features and no extensions. > What I didn't know was that the mode I asked about really is, > essentially, the vi editing mode, and, as such, has to be explicitly > turned on with 'set -o vi'. I wrongly thought there are 3 modes: emacs, > vi, and the one I asked about (the one described in the sh man page). > > > So, the short answer to my question would probabbly be: the commands > described in the mentioned section are relevant when the vi editing mode > of ksh is on. Oh, now i see how the misunderstanding can arise. I think we can make that clearer with the following patch. The new phrase is not only correct with respect to what our /bin/sh actually does, but it also agrees with POSIX as described on https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html . While POSIX requires the shell to support vi command line editing mode, it does not require that mode to be the default. It only requires that the mode can be enabled with "set -o vi". So the new description both works on OpenBSD and is required to work by POSIX, which is exacltly what we intend to describe in this page. OK? Ingo Index: sh.1 =================================================================== RCS file: /cvs/src/bin/ksh/sh.1,v retrieving revision 1.151 diff -u -r1.151 sh.1 --- sh.1 16 Dec 2018 13:08:35 -0000 1.151 +++ sh.1 22 May 2019 14:27:57 -0000 @@ -866,7 +866,11 @@ either internally in memory or in a file, as determined by .Dv HISTFILE . -The command line and all the commands in command history +When +.Cm vi +command line editing mode is enabled with the option +.Ic set Fl o Cm vi , +the command line and all the commands in command history can be edited using commands similar to those of .Xr vi 1 . .Pp