move some information off mksh.1; harmonise
This commit is contained in:
51
lksh.1
51
lksh.1
@@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/lksh.1,v 1.12 2015/10/09 19:28:20 tg Exp $
|
.\" $MirOS: src/bin/mksh/lksh.1,v 1.14 2015/10/09 20:33:49 tg Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015
|
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015
|
||||||
.\" mirabilos <m@mirbsd.org>
|
.\" mirabilos <m@mirbsd.org>
|
||||||
@@ -173,6 +173,20 @@ It is recommended to port scripts to
|
|||||||
.Nm mksh
|
.Nm mksh
|
||||||
instead of relying on legacy or idiotic POSIX-mandated behaviour,
|
instead of relying on legacy or idiotic POSIX-mandated behaviour,
|
||||||
since the MirBSD Korn Shell scripting language is much more consistent.
|
since the MirBSD Korn Shell scripting language is much more consistent.
|
||||||
|
.Pp
|
||||||
|
Note that it's strongly recommended to invoke
|
||||||
|
.Nm
|
||||||
|
with at least the
|
||||||
|
.Fl o Ic posix
|
||||||
|
option, if not both that
|
||||||
|
.Em and Fl o Ic sh ,
|
||||||
|
to fully enjoy better compatibility to the
|
||||||
|
.Tn POSIX
|
||||||
|
standard (which is probably why you use
|
||||||
|
.Nm
|
||||||
|
over
|
||||||
|
.Nm mksh
|
||||||
|
in the first place) or legacy scripts, respectively.
|
||||||
.Sh LEGACY MODE
|
.Sh LEGACY MODE
|
||||||
.Nm
|
.Nm
|
||||||
currently has the following differences from
|
currently has the following differences from
|
||||||
@@ -203,22 +217,30 @@ change between versions; see the accompanying manual page
|
|||||||
for the versions this document applies to.
|
for the versions this document applies to.
|
||||||
.It
|
.It
|
||||||
.Nm
|
.Nm
|
||||||
only offers the traditional ten file descriptors to scripts.
|
|
||||||
.It
|
|
||||||
.Nm
|
|
||||||
uses
|
uses
|
||||||
.Tn POSIX
|
.Tn POSIX
|
||||||
arithmetics, which has quite a few implications:
|
arithmetics, which has quite a few implications:
|
||||||
The data type for arithmetics is the host ISO C
|
The data type for arithmetics is the host
|
||||||
|
.Tn ISO
|
||||||
|
C
|
||||||
.Vt long
|
.Vt long
|
||||||
data type.
|
data type.
|
||||||
Signed integer wraparound is Undefined Behaviour.
|
Signed integer wraparound is Undefined Behaviour; this means that...
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
$ echo $((2147483647 + 1))
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
\&... is permitted to, e.g. delete all files on your system
|
||||||
|
(the figure differs for non-32-bit systems, the rule doesn't).
|
||||||
The sign of the result of a modulo operation with at least one
|
The sign of the result of a modulo operation with at least one
|
||||||
negative operand is unspecified.
|
negative operand is unspecified.
|
||||||
Shift operations on negative numbers are unspecified.
|
Shift operations on negative numbers are unspecified.
|
||||||
Division of the largest negative number by \-1 is Undefined Behaviour.
|
Division of the largest negative number by \-1 is Undefined Behaviour.
|
||||||
The compiler is permitted to delete all data and crash the system
|
The compiler is permitted to delete all data and crash the system
|
||||||
if Undefined Behaviour occurs.
|
if Undefined Behaviour occurs (see above for an example).
|
||||||
|
.It
|
||||||
|
.Nm
|
||||||
|
only offers the traditional ten file descriptors to scripts.
|
||||||
.It
|
.It
|
||||||
.\"XXX TODO: move this to FPOSIX
|
.\"XXX TODO: move this to FPOSIX
|
||||||
The rotation arithmetic operators are not available.
|
The rotation arithmetic operators are not available.
|
||||||
@@ -298,7 +320,18 @@ as
|
|||||||
.Pa /bin/sh ,
|
.Pa /bin/sh ,
|
||||||
compilation to enable
|
compilation to enable
|
||||||
.Ic set -o posix
|
.Ic set -o posix
|
||||||
by default is highly recommended for better standards compliance.
|
by default if called as
|
||||||
|
.Nm sh
|
||||||
|
is highly recommended for better standards compliance.
|
||||||
|
For better compatibility with legacy scripts, such as many
|
||||||
|
.Tn Debian
|
||||||
|
maintainer scripts, Upstart and SYSV init scripts, and other
|
||||||
|
unfixed scripts, using the compile-time options for enabling
|
||||||
|
.Em both
|
||||||
|
.Ic set -o posix -o sh
|
||||||
|
when the shell is run as
|
||||||
|
.Nm sh
|
||||||
|
is recommended.
|
||||||
.Pp
|
.Pp
|
||||||
.Nm
|
.Nm
|
||||||
tries to make a cross between a legacy bourne/posix compatibl-ish
|
tries to make a cross between a legacy bourne/posix compatibl-ish
|
||||||
@@ -308,7 +341,7 @@ is not exactly specified.
|
|||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Ic set
|
.Ic set
|
||||||
built-in command does not have all options one would expect
|
built-in command does not currently have all options one would expect
|
||||||
from a full-blown
|
from a full-blown
|
||||||
.Nm mksh
|
.Nm mksh
|
||||||
or
|
or
|
||||||
|
Reference in New Issue
Block a user