This is a request for explanation or pointer to documentation.
I'm a KornShell93 (
ksh on Mac OS X or
ksh93 elsewhere) user. I like the shell for its relative simplicity as an interactive shell and for its scripting capabilities, and I've been using it since the code was made more free in 2000. I use it in
vi editing mode, with both the
viraw options set.
There's a neat feature in
ksh93 that allows you to start typing a command on the command line and then press Up-arrow to get the latest matching command line out of the command line history. I can find the documentation for this and how it's bound to
vi editing mode, no problem.
However, if I press Up-arrow at an empty prompt, it first gives me the most recently executed command, then it starts cycling through whatever command prefix I had previously looked for. This annoys me no ends.
I execute these three commands:
$ ls -l $ ls -ld test $ ls -ld testdir
ls and then pressing Up-arrow three times will cycle through them in opposite order.
Later, with many more commands issued, but no history searches and no
$ cc -o testrun mytest.c $ man strncmp
If I now press Up-arrow once, I get
man strncmp. If I press Up-arrow again, I get
ls -ld testdir and then
ls -ld test rather than the command
cc -o testrun mytest.c and then the previous before that.
I'm looking for pointers for how to "fix" this so that Up-arrow without typing anything on the command line beforehand cycles through the most recent history without trying search for a previously used prefix. Even a pointer to somewhere where the behaviour above is documented would be nice.
ksh93 manual says
[count]kFetch previous command. Each time
kis entered the previous command back in time is accessed.
/stringSearch backward through history for a previous command containing
Stringis terminated by a
NEW LINE. If
stringis preceded by a
^, the matched line must begin with
stringis null, the previous
stringwill be used.
[count][AIf cursor is at the end of the line it is equivalent to
stringset to the contents of the current line. Otherwise, it is equivalent to
This does not explain why I first get
man strncmp (as if pressing k) and then get
ls -ld testdir in my example above. With the text of the manual in mind, I would expect to get
ls -ld testdir on the first press of Up-arrow (which would be even more annoying, by the way).