diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-14 12:47:01 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-14 12:47:01 +0100 |
| commit | e99be6e5dcadeb723434203f0dc1cf2bfa63962f (patch) | |
| tree | 1fe910df9a80637e5298df5f457bcd8a8ac53eb4 | |
| parent | e075a798672807be3e8f97991eeb18680673b98f (diff) | |
mk: ruthlessly simplify findpath()
i love eval, printf and awk
eval, printf and awk are the best things ever
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rwxr-xr-x | mk | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -16,16 +16,8 @@ eval "`printf "LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE \ findpath() { - [ $# -gt 0 ] && while [ $# -gt 0 ]; do - found="`readlink -f "$1" 2>/dev/null`" || return 1; : - [ -n "$found" ] || \ - found="`realpath "$1" 2>/dev/null`" || return 1 - - printf "%s\n" "$found" - shift 1 - done && return 0 - - err "findpath: No arguments provided" "findpath" "$@" + eval "$(printf '%s\n' "$@" | awk '{printf \ + "readlink -f \"%s\" || realpath \"%s\" || return 1;\n", $0, $0}')" } x_() |
