From: Johannes Sixt Date: Mon, 25 Dec 2017 09:26:27 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> Am 25.12.2017 um 01:28 schrieb Ævar Arnfjörð Bjarmason: > +create_test_file() { > + file=$1 > + > + case $file in > + # `touch .` will succeed but obviously not do what we intend > + # here. > + ".") > + return 1 > + ;; > + # We cannot create a file with an empty filename. > + "") > + return 1 > + ;; > + # The tests that are testing that e.g. foo//bar is matched by > + # foo/*/bar can't be tested on filesystems since there's no > + # way we're getting a double slash. > + *//*) > + return 1 > + ;; > + # When testing the difference between foo/bar and foo/bar/ we > + # can't test the latter. > + */) > + return 1 > + ;; > + esac Nice! > + > + # Turn foo/bar/baz into foo/bar to create foo/bar as a > + # directory structure. > + dirs=$(echo "$file" | sed -r 's!/[^/]+$!!') dirs=${file%/*} should do the same without forking processes, no? -- Hannes