From 2c76875ea31ad3dc7f48e9cce4065e0403752421 Mon Sep 17 00:00:00 2001 From: tg Date: Mon, 11 Feb 2013 17:17:59 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=A2=20Document=20invalid=20${a/b/c}=20pat?= =?UTF-8?q?terns=20in=20manpage=20(Debian=20#698678)=20=E2=80=A2=20add=20s?= =?UTF-8?q?peed=20hints=20and=20misc=20improvements;=20bump=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mksh.1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mksh.1 b/mksh.1 index c6db7fa..649594a 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,4 +1,4 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.303 2013/02/10 23:58:19 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.304 2013/02/11 17:17:59 tg Exp $ .\" $OpenBSD: ksh.1,v 1.145 2013/01/17 21:20:25 jmc Exp $ .\"- .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, @@ -74,7 +74,7 @@ .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" -.Dd $Mdocdate: February 10 2013 $ +.Dd $Mdocdate: February 11 2013 $ .\" .\" Check which macro package we use, and do other -mdoc setup. .\" @@ -1608,6 +1608,7 @@ begins with it is anchored at the beginning of the value; if it begins with .Ql % , it is anchored at the end. +Patterns that are empty or consist only of wildcards are invalid. A single .Ql / replaces the first occurence of the search @@ -1619,7 +1620,7 @@ is omitted, the .Ar pattern is replaced by the empty string, i.e. deleted. Cannot be applied to a vector. -Inefficiently implemented. +Inefficiently implemented, may be slow. .Pp .Sm off .It Xo @@ -1664,7 +1665,7 @@ Cannot be applied to a vector. The internal hash of the expansion of .Ar name , with an optional (defaulting to zero) -.Ar seed . +.Op Ar seed . At the moment, this is NZAAT (a 32-bit hash based on Bob Jenkins' one-at-a-time hash), but this is not set. This is the hash the shell uses internally for its associative arrays. @@ -2260,6 +2261,9 @@ matches no strings; the pattern matches all strings (think about it). .El .Pp +Note that complicated globbing, especially with alternatives, +is slow; using separate comparisons may (or may not) be faster. +.Pp Note that .Nm mksh .Po and Nm pdksh Pc @@ -4488,6 +4492,10 @@ or, to avoid pattern matching (see above): .Dq if \&[[ $foo = \&"$bar" \&]] .Pp +The +.Ic \&[[ ... ]] +construct is not only more secure to use but also often faster. +.Pp .It Xo .Ic time .Op Fl p @@ -6327,7 +6335,7 @@ $ /bin/sleep 666 && echo fubar .Ed .Pp This document attempts to describe -.Nm mksh\ R41 +.Nm mksh\ R42 and up, compiled without any options impacting functionality, such as .Dv MKSH_SMALL ,