summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-09-14 12:04:35 +0100
committerLeah Rowe <leah@libreboot.org>2026-09-14 12:08:53 +0100
commit76bf71ff65dd427cc54ff027b7757e7a4f058504 (patch)
treecb54ae4a442339e853af9af835c63f280daab6a9 /mk
parentc4695497f5b0b74e07d68d69875274a38e0a62c4 (diff)
mk: simplified findpath()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'mk')
-rwxr-xr-xmk17
1 files changed, 6 insertions, 11 deletions
diff --git a/mk b/mk
index 890a3465..29ce12b6 100755
--- a/mk
+++ b/mk
@@ -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_()