diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-14 12:04:35 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-14 12:08:53 +0100 |
| commit | 76bf71ff65dd427cc54ff027b7757e7a4f058504 (patch) | |
| tree | cb54ae4a442339e853af9af835c63f280daab6a9 /mk | |
| parent | c4695497f5b0b74e07d68d69875274a38e0a62c4 (diff) | |
mk: simplified findpath()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'mk')
| -rwxr-xr-x | mk | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -16,21 +16,16 @@ eval "`printf "LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE \ findpath() { - [ $# -lt 1 ] && \ - err "findpath: No arguments provided" "findpath" "$@" - - while [ $# -gt 0 ] - do + [ $# -gt 0 ] && while [ $# -gt 0 ]; do found="`readlink -f "$1" 2>/dev/null`" || return 1; : - - if [ -z "$found" ]; then - found="`realpath "$1" 2>/dev/null`" || \ - return 1 - fi + [ -n "$found" ] || \ + found="`realpath "$1" 2>/dev/null`" || return 1 printf "%s\n" "$found" shift 1 - done + done && return 0 + + err "findpath: No arguments provided" "findpath" "$@" } x_() |
