From cba04aa74b816cbd5f1266a73962f6dd48ee2892 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:00:13 +0100 Subject: init.sh: Use readlink in pybin() Use realpath only as a fallback. Signed-off-by: Leah Rowe --- include/lib.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/lib.sh') diff --git a/include/lib.sh b/include/lib.sh index 950a07c8..99e59a1a 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -144,6 +144,18 @@ singletree() return 1 } +findpath() +{ + [ $# -gt 0 ] || err "findpath: No arguments provided" + 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 +} + fx_() { fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" -- cgit v1.2.1