be-next commited on
Commit
b829a0a
·
unverified ·
1 Parent(s): c6adc54

models : handle spaces and special characters in shell script paths (#677)

Browse files

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.

Files changed (1) hide show
  1. models/download-ggml-model.sh +1 -1
models/download-ggml-model.sh CHANGED
@@ -12,7 +12,7 @@ pfx="resolve/main/ggml"
12
  # get the path of this script
13
  function get_script_path() {
14
  if [ -x "$(command -v realpath)" ]; then
15
- echo "$(dirname $(realpath $0))"
16
  else
17
  local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
18
  echo "$ret"
 
12
  # get the path of this script
13
  function get_script_path() {
14
  if [ -x "$(command -v realpath)" ]; then
15
+ echo "$(dirname "$(realpath "$0")")"
16
  else
17
  local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
18
  echo "$ret"