help-bash
[Top][All Lists]
Advanced

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

Re: Character clearance in either end front or back


From: Greg Wooledge
Subject: Re: Character clearance in either end front or back
Date: Thu, 8 Oct 2020 07:19:45 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Oct 08, 2020 at 12:00:06PM +0200, Reuti wrote:
> > Am 08.10.2020 um 08:06 schrieb Budi <budikusasi@gmail.com>:
> > but merely
> > clearing \\\  as in l=foo\\\
> > 
> > k=${%%\}
> 
> To remove all you will need a wildcard:
> 
> k=${l%%\\*}

No, that won't do it either.  You need an extended glob.

shopt -s extglob
k=${l%%+(\\)}

Without extended globs, you could do it using a loop that removes one
backslash at a time, but that's obviously going to be slower.



reply via email to

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