hi! notice how ksh's history command (fc -l) does not list the last typed history command:
$ ls $ date Wed Aug 13 19:29:59 BST 2014 $ history 1 ls 2 date the only thing i have to compare it with is bash: bash-4.3$ ls bash-4.3$ date Wed Aug 13 19:31:47 BST 2014 bash-4.3$ history 1 ls 2 date 3 history i think ksh's behaviour is wrong, but i'm unable to find anything that says how it should behave. note that commands like (in vi editing mode) "2k" in the example above will bring up "date", which is correct but confusing in ksh's case (since looking at the output of "history" you'd expect "ls"). anyone? note i have "a fix", included below, but it was produced using the theory about an infinite number of monkeys with an infinite amount of time. i definitely do not profer it in seriousness. jmc Index: history.c =================================================================== RCS file: /cvs/src/bin/ksh/history.c,v retrieving revision 1.39 diff -u -r1.39 history.c --- history.c 19 May 2010 17:36:08 -0000 1.39 +++ history.c 13 Aug 2014 18:38:16 -0000 @@ -190,7 +190,7 @@ const char *nfmt = nflag ? "\t" : "%d\t"; for (hp = rflag ? hlast : hfirst; - hp >= hfirst && hp <= hlast; hp += rflag ? -1 : 1) { + hp >= hfirst && hp <= hlast + 1; hp += rflag ? -1 : 1) { shf_fprintf(shl_stdout, nfmt, hist_source->line - (int) (histptr - hp)); /* print multi-line commands correctly */