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


Groups > gnu.bash.bug > #16861

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 Lawrence Velázquez <vq@larryv.me>
Newsgroups gnu.bash.bug
Subject Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work
Date Sat, 29 Aug 2020 21:12:35 -0400
Lines 38
Approved bug-bash@gnu.org
Message-ID <mailman.1747.1598749964.2469.bug-bash@gnu.org> (permalink)
References <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>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0 (Mac OS X Mail 12.4 \(3445.104.15\))
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1598749964 12227 209.51.188.17 (30 Aug 2020 01:12:44 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Koichi Murase <myoga.murase@gmail.com>, bug-bash@gnu.org
To Bruce Lilly <bruce.lilly@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=larryv.me; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=w isT/W8ZvhF0txmiEz4EvherbA0zQSwdUc59VjpDHdQ=; b=I04leCLW43e3LVT8x W/+pMPsNPfN9PU/MHTvEvAXDZsmtxDVPCVeQ+6VM2zhkXTyZU0pCvlIjACmMtK6w vU2cUkfVntGE3t2T420Ya20y3QXjPLizFmScKkWMDvqw1jmboipG9u4vpVUfJKtp 2lOJE9WlIRXVL/F1rhGlDr7FT8LSwbrgR1IQDbwQIwUkmjMKjMxOYNgi/Tc8bn6J jLkNfnMUq9e+Z5j5V8YWz7hxIeOiZ1BG61xJOdKUfZ9Ooh29uuo+Bbhe2NxAajKO msVAu2sCfWPsPHveAzwLA2SI+oGkaYmEspz7dVqgRTBPUv6vZ8zh2ITSJYnL1/uL Pi2vw==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=wisT/W8ZvhF0txmiEz4EvherbA0zQSwdUc59VjpDH dQ=; b=BKRDBCH9cuiaE17CVqOAL38ft1swlQe4QY9jv53vAMVkoUa45sSH+MqEK uiKrRSiERU953KRTg8jBhoy7HG+sPcNBFcqfw7m5l8skgHa6HiB8OgzAx0P2s+dS 5HegPp8NhTEtnKOxYMznBgmrFEEohAiYU4wggvop78MHAm/Uzypq+qGPUysh70Wo GusZWFNErYyR6GS0ymsP0tzk0QUDDNhzqrXcNlt8tF8s/UX5cF3okDaC3FbCNS5X KnB6LG7ZBAP2gCXLTHG1mG6L0qarKID0V/UIql7qA8Q1RFbriwEZE6g/pWk1FEvN 4xWMA2a+bPc/u0aaSK7CUydS84ekw==
X-ME-Sender <xms:Bv1KXz5QxQGMCOQwLq9J0Nhb6WhWB3pY0tL1aWaXik2Y6Hh-IXBsig>
X-ME-Proxy-Cause gggruggvucftvghtrhhoucdtuddrgeduiedrudefvddggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtvdenucfhrhhomhepnfgrfihr vghntggvpgggvghljoiiqhhuvgiiuceovhhqsehlrghrrhihvhdrmhgvqeenucggtffrrg htthgvrhhnpeegteehjeeukeegffehhfejveejieehgedvueegkedtgeffjefhheegtefg jeelvdenucfkphepuddttddruddvrddukedtrdehfeenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehvqheslhgrrhhrhihvrdhmvg
X-ME-Proxy <xmx:Bv1KX476OAzXOehQ4Vew8lKC9e7QT8eEqTDS0lz8pI0RGcDOykakow> <xmx:Bv1KX6eapnsnGxCACd7VqvktXXz_0qp1uBwpLQnHDeDJQwnWnDvOGA> <xmx:Bv1KX0JPuf0-0vSxb42FOyAuhXPjsCVh52IJi42HzyBynzBPPfgh-Q> <xmx:Bv1KXymxQM8m_68DaSPuRgr3Ocgpg8yTOVy8meEOwMpIPu70Kbo0Sw>
In-Reply-To <CAPyES34iHv0YzEjQd1me3qV2JrZ=XOgvR_Wb5SpZ=5cYWQ3-vQ@mail.gmail.com>
X-Mailer Apple Mail (2.3445.104.15)
Received-SPF pass client-ip=66.111.4.27; envelope-from=vq@larryv.me; helo=out3-smtp.messagingengine.com
X-detected-operating-system by eggs.gnu.org: First seen = 2020/08/29 21:12:38
X-ACL-Warn Detected OS = Linux 2.2.x-3.x [generic] [fuzzy]
X-Spam_score_int -27
X-Spam_score -2.8
X-Spam_bar --
X-Spam_report (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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 <C4224EEC-8FBF-472A-88DF-B96BA3F1A8CB@larryv.me>
X-Mailman-Original-References <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>
Xref csiph.com gnu.bash.bug:16861

Show key headers only | View raw


> On Aug 29, 2020, at 8:41 PM, Bruce Lilly <bruce.lilly@gmail.com> wrote:
> 
>> On Sat, Aug 29, 2020 at 4:53 PM Koichi Murase <myoga.murase@gmail.com> wrote:
>> 
>> Yes, I know that it is confusing to those who are familiar with modern
>> Perl-style regular expressions.  But historically, POSIX regular
>> expressions do not support the backslash escape sequences in bracket
>> expressions `[...]'.  The backslash escape sequences in bracket
>> expressions were the extension historically.  As far as I know, in
>> POSIX, only awk supports backslash sequences in regular expressions.
> 
> Actually, it works (portably) with
> separator2=$'\057'

(a) $'...' is not POSIX. For instance, dash does not recognize it.

	% port installed dash
	The following ports are currently installed:
	  dash @0.5.11.1_0 (active)
	% dash <<\EOF
	heredoc> printf '<%s>\n' $'\057'
	heredoc> EOF
	<$\057>

(b) If you define separator2 in that way and then substitute it,
    the context into which it is substituted sees a slash character,
    not the backslash-escaped octal.

	$ echo "$BASH_VERSION"
	5.0.17(1)-release
	$ printf '%s\n' $'\057'
	/

vq

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


Thread

Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work Lawrence Velázquez <vq@larryv.me> - 2020-08-29 21:12 -0400

csiph-web