[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Best way to remove trailing '/' from a path?
From: |
Stephane Chazelas |
Subject: |
Re: [Help-bash] Best way to remove trailing '/' from a path? |
Date: |
Mon, 20 Apr 2015 22:43:36 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
2015-04-20 17:04:44 -0400, Greg Wooledge:
> On Mon, Apr 20, 2015 at 02:58:22PM -0600, Eric Blake wrote:
> > And I'm half wondering if the original poster is trying to
> > (re-)implement dirname without forking.
>
> The one thing I'm certain of is that we can't answer the question until
> we know what it IS. Which we don't. There has been no clarification
> so far.
[...]
I think the question was clear enough: remove the trailing
slashes, but turn "////" into "/" instead of "" as ${VAR%%+(/)}
would (though as Eric pointed out, one may want *not* to turn
"//" into "/" as "//" and "/" are different paths on some
systems).
Now, one may want to do more clean-ups in paths like remove
consecutive slashes within (foo//bar), or remove redundant "."
components (foo/./bar, /foo/., ...).
--
Stephane
- Re: [Help-bash] Best way to remove trailing '/' from a path?, (continued)
Re: [Help-bash] Best way to remove trailing '/' from a path?, Stephane Chazelas, 2015/04/20
Re: [Help-bash] Best way to remove trailing '/' from a path?, Stephane Chazelas, 2015/04/20
Re: [Help-bash] Best way to remove trailing '/' from a path?, Chris F.A. Johnson, 2015/04/20
Re: [Help-bash] Best way to remove trailing '/' from a path?, Eric Blake, 2015/04/21