help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regex and glob patterns in Parameter Expansion


From: Kerin Millar
Subject: Re: Regex and glob patterns in Parameter Expansion
Date: Sun, 19 Mar 2023 15:15:21 +0000

On Sun, 19 Mar 2023 15:07:33 +0000
uzibalqa <uzibalqa@proton.me> wrote:

> 
> 
> 
> ------- Original Message -------
> On Monday, March 20th, 2023 at 2:44 AM, alex xmb ratchev <fxmbsw7@gmail.com> 
> wrote:
> 
> 
> > 
> > 
> > On Sun, Mar 19, 2023, 2:20 PM uzibalqa <uzibalqa@proton.me> wrote:
> > 
> > > 
> > > Does Shell Parameter Expansion accept regex or glob patterns?
> > > 
> > > ${str/$ptrn/}
> > > 
> > > ${str##$ptrn}
> > > 
> > > ${str%%$ptrn}/}
> > 
> > 
> > they accept , if not quoted , glob s
> 
> What instances would one pass quoted patterns ?  

In instances where you don't want for them to be treated as globs.

$ str="foo*bar"; printf %s\\n "${str/"*"}"
foobar

-- 
Kerin Millar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]