summaryrefslogtreecommitdiff
path: root/bin/ksh/sh.1
diff options
context:
space:
mode:
authortb <tb@cvs.openbsd.org>2016-03-21 13:35:01 +0000
committertb <tb@cvs.openbsd.org>2016-03-21 13:35:01 +0000
commit6812a0d79be216cf7e477c5bf4ef68de11fed6e6 (patch)
treef8c5ad837f76be1ff8588094103b17ee4630e0bf /bin/ksh/sh.1
parentb035e3d07c38fac27521c14f1565c4dc21ba3de4 (diff)
More ksh POSIX compliance fixes by Martijn Dekker:
This simple patch makes the 'command' builtin POSIX-compliant and consistent with other current shells. It fixes two things: a) 'command -v' does not find shell reserved words (a.k.a. keywords). For instance, 'command -v select' outputs nothing but should output 'select'. b) 'command -pv' always outputs the path of an external command, even if 'command -p' would execute a builtin. For instance, 'command -p kill' executes the 'kill' builtin, as expected, but 'command -pv kill' outputs '/bin/kill'. The '-v' option is supposed to reflect what would actually be executed, so 'command -pv kill' should output 'kill'. The -p option sets the PATH to a default system value before doing the search, but that has no bearing on the fact that builtins take precedence over external commands. The patch fixes both issues for 'command' without affecting the behaviour of the ksh-specific builtin 'whence', which is handled by the same C function. Regression test added to obsd-regress.t. Issues found and fixed by Martijn Dekker, ok millert@
Diffstat (limited to 'bin/ksh/sh.1')
-rw-r--r--bin/ksh/sh.17
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/ksh/sh.1 b/bin/ksh/sh.1
index cb5a0c07d33..86a340dc86a 100644
--- a/bin/ksh/sh.1
+++ b/bin/ksh/sh.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sh.1,v 1.130 2015/10/12 12:34:42 jmc Exp $
+.\" $OpenBSD: sh.1,v 1.131 2016/03/21 13:35:00 tb Exp $
.\"
.\" Copyright (c) 2015 Jason McIntyre <jmc@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 12 2015 $
+.Dd $Mdocdate: March 21 2016 $
.Dt SH 1
.Os
.Sh NAME
@@ -329,6 +329,9 @@ but identify how the shell will interpret it
Do not invoke
.Ar command ,
but identify the pathname the shell will use to run it.
+For aliases, a command to define that alias is printed.
+For shell reserved words, shell functions, and built-in utilities,
+just the name is printed.
.El
.Pp
The exit status is that of