From 18e6fb0287b5f851a5c0fbd0bb13b66f7197e540 Mon Sep 17 00:00:00 2001 From: be-next Date: Wed, 29 Mar 2023 22:38:33 +0200 Subject: [PATCH] models : handle spaces and special characters in shell script paths (#677) This commit modifies the `get_script_path` function to correctly handle spaces and special characters in directory paths. The fix involves adding double quotes around variables and commands where needed to ensure proper parsing of paths with spaces and special characters. --- models/download-ggml-model.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/download-ggml-model.sh b/models/download-ggml-model.sh index 6fda18ea..749b409c 100755 --- a/models/download-ggml-model.sh +++ b/models/download-ggml-model.sh @@ -12,7 +12,7 @@ pfx="resolve/main/ggml" # get the path of this script function get_script_path() { if [ -x "$(command -v realpath)" ]; then - echo "$(dirname $(realpath $0))" + echo "$(dirname "$(realpath "$0")")" else local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" echo "$ret"