From dff6987bba8f9233f38d746967ed92348cdd9e2f Mon Sep 17 00:00:00 2001 From: ale5000 <15793015+ale5000-git@users.noreply.github.com> Date: Fri, 1 Nov 2024 02:05:31 +0100 Subject: [PATCH] Update cmdline.sh --- cmdline.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cmdline.sh b/cmdline.sh index 9b6a9141..a948da68 100755 --- a/cmdline.sh +++ b/cmdline.sh @@ -28,18 +28,8 @@ if test "${A5K_FUNCTIONS_INCLUDED:-false}" = 'false'; then if test -z "${MAIN_DIR-}"; then # shellcheck disable=SC3028,SC2128 # Intended: In POSIX sh, BASH_SOURCE is undefined / Expanding an array without an index only gives the first element - if MAIN_DIR="${BASH_SOURCE-}" && test -n "${MAIN_DIR}"; then - : - elif printf '%s\n' "${1}" | grep -q -m 1 -- 'cmdline.sh$' && MAIN_DIR="${1}"; then - : - else MAIN_DIR=''; fi -echo '---' -printf '%s\n' "${1}" || echo $? -echo '---' -printf '%s\n' "${1}" | grep -q -m 1 -- 'cmdline.sh$' || echo $? -echo '---' -dirname "${MAIN_DIR}" || echo $? -echo '---' + if MAIN_DIR="${BASH_SOURCE-}" && test -n "${MAIN_DIR}"; then :; else MAIN_DIR="${1}"; fi + case "${MAIN_DIR}" in *'cmdline.sh') ;; *) MAIN_DIR='' ;; esac if test -n "${MAIN_DIR}" && MAIN_DIR="$(dirname "${MAIN_DIR}")" && MAIN_DIR="$(realpath "${MAIN_DIR}")"; then export MAIN_DIR