Hi everyone,
mksh R46 is out, with the killer feature: if you press Cursor-Up in
the Vi insert mode, it does the same thing as PgUp in Emacs mode:
take the input line up to the cursor and do an anchored backwards
history search (repeatable) for it.
Other features include “set -o pipefail” (the existence of which in
other shells and how it works I only became aware a month or so ago)
and “value substitution”:
Command and Function Substitution work as follows:
x=$(echo foo; echo >&2 bar)
x=${ echo foo; echo >&2 bar;}
Both will echo “bar” to stderr and set x="foo".
The first form (command substitution) has the overhead of a fork,
the second form (function substitution) runs in the current shell
environment but has the overhead of a tempfile.
Value substitution works like this:
x=${|REPLY=foo; echo bar;}
This will also set x="foo" but echo bar to stdout (it is *not*
redirected). It has neither a penalty of fork nor of tempfile.
The parameter REPLY is initially set as local to the expression
and empty; its final value is what the expression evaluates to.
I’ve rewritten $PS1 in dot.mkshrc to make use of it.
Additionally, the lksh(1) manual page is now shipped alongside
with mksh (for having a single point of where it is kept, mostly)
and has been sync’d with the actual code. Warnings about POSIX
and ISO C behaviour have been added ☺ “set -o” in lksh on 64-bit
systems works again.
One can now run “set -o posix -o sh” as one command and set both
shell flags at once (setting just one still unsets the other);
this is mostly used to make /bin/sh-shells (-DMKSH_BINSHREDUCED
plus the new -DMKSH_BINSHPOSIX) a bit more POSIXly.
Leading digit-zero numbers are now interpreted as octal in both
mksh and lksh only in POSIX mode, for those who do need it. In
lksh, enabling POSIX mode disables traditional “set -- getopts”
behaviour; in mksh, it’s only used if sh mode is enabled *and*
POSIX mode is disabled.
Finally, if neither hd(1) nor hexdump(1) are available, a “hd”
function comprising a Pure mksh™ hexdump utility (NUL-safe)
with the semantics of MirBSD “hd -v” is provided by dot.mkshrc.
Oh, and I changed more signed integers to unsigned… *sigh*
Chris: let me just say it here once: thanks for keeping mksh
up to date in Cygwin; I’ll not reply to every single “all tests
passed” mail, but it’s still appreciated. (Although I’d only
send a mail if not everything is good.)
Further directions:
• SIGINT behaviour – very complicated
• DEBUG trap – must be very carefully planned; GNU bash and
AT&T ksh93 write *lots* in their manpages and are not fully equal
• reworking configury to make use of a host compiler for some checks
• port to NuttX? (maybe RT is interested in doing that) They seem
to have a 32-bit POSIX-ish mode.
• and more – https://www.mirbsd.org/mksh.htm#plans has some, with
no guarantee they will ever be done, just that they are listed
The old “associative arrays, multidimensional arrays, JSON” part
is also still “on the radar”. Use contrib/hosted/tg/assockit.ksh
from the MirBSD CVS in the meantime; the Shellsnippets git repo
has just been amended by an LDIF/LDAP parser for it.
As usual, user contributions¹ are appreciated, no matter whether
they end up in mksh (immediately or much later, we had that too)
or not. I feel like we’ve got some sort of community, with users
answering other users’ questions on this mailing list, and in
IRC of course, already; this makes me happy ☻
mirabilos at conferences – next on my radar: FrOSCon; OpenRheinRuhr
bye,
//mirabilos
① One doable, not too trivial, not too complicated, easily
isolatable, thing to do, maybe as some GSoC-like thing,
would be to add UTF-8 support to the Vi editing mode too.
It appears we have more than just a handfull of users of
it, but I personally can’t bear it, and testing the changes
is obviously needed all the time. The MirOS Project does
not have any monetary funds, though, so this (and others,
if you, Benny or me can think of any) is strictly volunteer
although I’d hand out papers (certificates?) if needed, to
look good on a CV.
--
<mirabilos> │ untested
<Natureshadow> │ tut natürlich
<Natureshadow> │ was auch sonst ...
<mirabilos> │ fijn ☺