diff options
author | anton <anton@cvs.openbsd.org> | 2017-07-04 07:29:33 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2017-07-04 07:29:33 +0000 |
commit | 299d16dcefe7d2df4e7a24f3f27315966f005dae (patch) | |
tree | d2e7ce97543210b7359ba550c65e4eae03de5967 /bin/ksh/ksh.1 | |
parent | a3243272b92264f36031507f8553cb352b4094c7 (diff) |
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.
Diffstat (limited to 'bin/ksh/ksh.1')
-rw-r--r-- | bin/ksh/ksh.1 | 16 |
1 files changed, 14 insertions, 2 deletions
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 |