[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Best way to remove trailing '/' from a path?
From: |
Joseph Pesco |
Subject: |
Re: [Help-bash] Best way to remove trailing '/' from a path? |
Date: |
Sat, 11 Apr 2015 10:30:44 -0400 |
On Sat, 11 Apr 2015 01:27:07 -0400 (EDT)
"Chris F.A. Johnson" <address@hidden> wrote:
> On Fri, 10 Apr 2015, Peng Yu wrote:
>
> > On Fri, Apr 10, 2015 at 10:44 PM, Chris F.A. Johnson
> > <address@hidden> wrote:
> >> On Fri, 10 Apr 2015, Peng Yu wrote:
> >>
> >>> Hi, ${VAR%%+(/)} has been suggested here. But it is not robust if $VAR
> >>> is just a bunch of slashes. Does anybody have a robust yet succinct
> >>> implementation?
> >>
> >>
> >> ${var%/}
> >
> > I should have said to remove all trailing slashes.
> >
> > This does not work for something like x////.
>
> ${var%${var##*[!/]}}"
>
> --
> Chris F.A. Johnson, <http://cfajohnson.com>
>
Sorry, test message.
--
Joseph Pesco <address@hidden>
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