Re: [PATCH v2 7/7] wildmatch test: create & test files on disk in addition to in-memory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 27, 2017, 19:07 UTC
- Message-ID
- <xmqqr2rgm1kv.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20171225002835.29005-8-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> + # Turn foo/bar/baz into foo/bar to create foo/bar as a > + # directory structure. > + dirs=$(echo "$file" | sed -r 's!/[^/]+$!!')
Let's not limit this script to GNUism systems.
You want to see if $file has a slash followed by one or more non-slash letters to the end and strip the whole thing. We further know that at this point $file does not end with a slash. So perhaps
dirs=${file%/*}is sufficient?
Thanks.