Re: [Help-bash] Best way to remove trailing '/' from a path?
From:
Eduardo A . Bustamante López
Subject:
Re: [Help-bash] Best way to remove trailing '/' from a path?
Date:
Mon, 13 Apr 2015 07:41:04 -0500
User-agent:
Mutt/1.5.23 (2014-03-12)
On Mon, Apr 13, 2015 at 08:20:29AM -0400, Greg Wooledge wrote:
> On Fri, Apr 10, 2015 at 11:00:58PM -0500, Peng Yu wrote:
> > I should have said to remove all trailing slashes.
>
> I fail to see why ${var%%+(/)} is not the correct answer to that.
> Yes, it converts /////// to an empty string, but isn't that the
> desired outcome?
>
Additionally, one can always do: "${var%%+(/)}/" to force the presence of at
least one slash.
--
Eduardo Bustamante
https://dualbus.me/