|
From: | Chris F.A. Johnson |
Subject: | Re: [Help-bash] Best way to remove trailing '/' from a path? |
Date: | Sat, 11 Apr 2015 01:27:07 -0400 (EDT) |
User-agent: | Alpine 2.10 (DEB 1266 2009-07-14) |
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>
[Prev in Thread] | Current Thread | [Next in Thread] |