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