|
From: | Chris Elvidge |
Subject: | Re: Character clearance in either end front or back |
Date: | Thu, 8 Oct 2020 14:56:18 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Lightning/5.4 |
On 08/10/2020 12:19 pm, Greg Wooledge wrote:
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.
l='foo\\\' echo ${l\\*} works for me. (bash 5.1.0) foo -- Chris Elvidge England
[Prev in Thread] | Current Thread | [Next in Thread] |