Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16864

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work
Date Sun, 30 Aug 2020 16:00:46 +0700
Lines 21
Approved bug-bash@gnu.org
Message-ID <mailman.1758.1598778080.2469.bug-bash@gnu.org> (permalink)
References <CAPyES35Ca6yUirzYX71n+9TOcs6f_Ur5sSGT-D39nQ5bzK_jiw@mail.gmail.com> <CAPyES363zNvUZHWo6imXOyC3UPU5FAbsyFGzWkcJMO-HBhT6gQ@mail.gmail.com> <CAFLRLk_k+J3-Nt9UJ4Fb8c-RewPnVjf_b=ShqGGASG0GmREAhg@mail.gmail.com> <CAPyES3685SjyZfrL+M_56wGqxvh=N9xNchWJ1xqMSrmmEJb9ww@mail.gmail.com> <CAFLRLk9CBn1CUchi5tHmZ7FitWWpLaVc-Sxyr7=AuGRAQXWe9Q@mail.gmail.com> <CAPyES37OZ-TAjmxRp72dv97eKPzNes=__QqnBHuEK+rK78QSSg@mail.gmail.com> <CAFLRLk-WondkFshbc5=vF=20dViDyn20E7eps3rMJaog4ag7Yg@mail.gmail.com> <CAPyES34iHv0YzEjQd1me3qV2JrZ=XOgvR_Wb5SpZ=5cYWQ3-vQ@mail.gmail.com> <C4224EEC-8FBF-472A-88DF-B96BA3F1A8CB@larryv.me> <26506.1598778046@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1598778080 30178 209.51.188.17 (30 Aug 2020 09:01:20 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Lawrence Velázquez <vq@larryv.me>, Koichi Murase <myoga.murase@gmail.com>, bug-bash@gnu.org
To Bruce Lilly <bruce.lilly@gmail.com>
Envelope-to bug-bash@gnu.org
In-Reply-To <CAPyES35Ca6yUirzYX71n+9TOcs6f_Ur5sSGT-D39nQ5bzK_jiw@mail.gmail.com>
X-Host-Lookup-Failed Reverse DNS lookup failed for 2001:3c8:9009:181::2 (deferred)
Received-SPF permerror client-ip=2001:3c8:9009:181::2; envelope-from=kre@munnari.OZ.AU; helo=munnari.OZ.AU
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -10
X-Spam_score -1.1
X-Spam_bar -
X-Spam_report (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, T_SPF_HELO_PERMERROR=0.01, T_SPF_PERMERROR=0.01 autolearn=no autolearn_force=no
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <26506.1598778046@jinx.noi.kre.to>
X-Mailman-Original-References <CAPyES35Ca6yUirzYX71n+9TOcs6f_Ur5sSGT-D39nQ5bzK_jiw@mail.gmail.com> <CAPyES363zNvUZHWo6imXOyC3UPU5FAbsyFGzWkcJMO-HBhT6gQ@mail.gmail.com> <CAFLRLk_k+J3-Nt9UJ4Fb8c-RewPnVjf_b=ShqGGASG0GmREAhg@mail.gmail.com> <CAPyES3685SjyZfrL+M_56wGqxvh=N9xNchWJ1xqMSrmmEJb9ww@mail.gmail.com> <CAFLRLk9CBn1CUchi5tHmZ7FitWWpLaVc-Sxyr7=AuGRAQXWe9Q@mail.gmail.com> <CAPyES37OZ-TAjmxRp72dv97eKPzNes=__QqnBHuEK+rK78QSSg@mail.gmail.com> <CAFLRLk-WondkFshbc5=vF=20dViDyn20E7eps3rMJaog4ag7Yg@mail.gmail.com> <CAPyES34iHv0YzEjQd1me3qV2JrZ=XOgvR_Wb5SpZ=5cYWQ3-vQ@mail.gmail.com> <C4224EEC-8FBF-472A-88DF-B96BA3F1A8CB@larryv.me>
Xref csiph.com gnu.bash.bug:16864

Show key headers only | View raw


    Date:        Sat, 29 Aug 2020 22:08:14 -0400
    From:        Bruce Lilly <bruce.lilly@gmail.com>
    Message-ID:  <CAPyES35Ca6yUirzYX71n+9TOcs6f_Ur5sSGT-D39nQ5bzK_jiw@mail.gmail.com>

  | dash also doesn't have adequate pattern matching for the example
  | task (building a path while ensuring no empty components); it
  | has no way to specify one-or-more (or zero-or-more) occurrences
  | of a pattern such as a slash.

It does, you just don't get to do it in one absurdly complex variable
expansion.   There is very little that can't be done in sh that is
reasonable to attempt in sh code (floating point matrix inversions are
probably not a candidate for example) - including even the original
7th edition Bourne sh (with no functions, nothing builtin, bugs all over
the place, ...)   Sometimes it takes a bunch of code, and sometimes it
might not be extremely fast, but it is possible.

kre

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work Robert Elz <kre@munnari.OZ.AU> - 2020-08-30 16:00 +0700

csiph-web