From 299d16dcefe7d2df4e7a24f3f27315966f005dae Mon Sep 17 00:00:00 2001 From: anton Date: Tue, 4 Jul 2017 07:29:33 +0000 Subject: Add support for pattern substitution to variables in ksh using a common syntax borrowed from ksh93. Survived a ports build performed by naddy@ and encouraged by many. --- bin/ksh/ksh.1 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'bin/ksh/ksh.1') diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1 index bf260d1bc83..4902e06ffae 100644 --- a/bin/ksh/ksh.1 +++ b/bin/ksh/ksh.1 @@ -1,8 +1,8 @@ -.\" $OpenBSD: ksh.1,v 1.188 2017/06/20 17:32:20 brynet Exp $ +.\" $OpenBSD: ksh.1,v 1.189 2017/07/04 07:29:32 anton Exp $ .\" .\" Public Domain .\" -.Dd $Mdocdate: June 20 2017 $ +.Dd $Mdocdate: July 4 2017 $ .Dt KSH 1 .Os .Sh NAME @@ -1240,6 +1240,18 @@ of them result in the longest match. .It Pf ${ Ar name Ns % Ns Ar pattern Ns } .It Pf ${ Ar name Ns %% Ns Ar pattern Ns } Like ${..#..} substitution, but it deletes from the end of the value. +.Pp +.It Pf ${ Ns Ar name Ns / Ns Ar pattern Ns / Ns Ar replacement Ns } +.It Pf ${ Ns Ar name Ns // Ns Ar pattern Ns / Ns Ar replacement Ns } +The first longest match of +.Ar pattern +in the value of parameter +.Ar name +is substituted with +.Ar replacement . +Using +.Ql // , +all matches are substituted. .El .Pp The following special parameters are implicitly set by the shell and cannot be -- cgit v1.2.3