From: Junio C Hamano Date: Wed, 27 Dec 2017 19:07:44 GMT Subject: Re: [PATCH v2 7/7] wildmatch test: create & test files on disk in addition to in-memory Message-ID: In-Reply-To: <20171225002835.29005-8-avarab@gmail.com> Ævar Arnfjörð Bjarmason 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.