help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Best way to remove trailing '/' from a path?


From: Eric Blake
Subject: Re: [Help-bash] Best way to remove trailing '/' from a path?
Date: Tue, 21 Apr 2015 08:00:27 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 04/10/2015 09:11 PM, 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? Thanks.
> 
> http://stackoverflow.com/questions/9018723/what-is-the-simplest-way-to-remove-trailing-slashes-from-each-parameter

Generally, posting a URL in isolation is not going to get you as good an
answer as actually posting the question contained at that URL, as not
everyone is willing to go chase down the extra information that was not
already in the email.  Posting the URL _in addition_ to the question is
fine, but it's best to ask the question directly.

Reading that page, it looks like the original poster (named "sid_com" -
is that you? And if not, why are you reposting someone else's
questions?) wants to alter the passed-in parameters in $@ to remove
trailing slashes for subsequent use by rsync:
        
>> 
>> What is the simplest way to remove trailing slashes from each parameter in 
>> the '$@' array, so that rsync copies the directories by name?
>> 
>> rsync -a --exclude='*~' "$@" "$dir"
>> 

This thread has evolved on the bash mailing list in spite of not having
the original question at hand; maybe the next time you try to forward a
question, you can help everyone involved by giving better details.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]