Reverse `find`
Richard Mortier · February 05, 2025 · #tech #codeIn the last few days I discovered I needed to search back up the filesystem from $CWD
to find the first occurence of a file (specifically, a Justfile
but that’s by-the-by). Got bored of doing it by hand so wrote a bash
shell function; here ’tis:
Invoke as (e.g.,) rf Justfile
. Alternatively, as a one-liner:
F=Justfile; while ; do [ && break; D= /..; done;