nordtheme/gnome-terminal

./nord.sh: line 275: missing_deps: unbound variable

dontbejeff opened this issue · 4 comments

When running this shell script, get this error message when running.

Same here!

I was also getting this error. For reference, I am on Ubuntu 22.04, using Bash 5.1.16. I was able to solve the issue by declaring the variable missing_deps in a new line, with empty parentheses, like so:

validate_dependencies() {
  declare -a deps=("${!1}")
  declare -a missing_deps=()
  for exec in "${deps[@]}"; do
    if ! command -v "${exec}" > /dev/null 2>&1; then
      missing_deps+=(${exec})
    fi
  done
  if [ "${#missing_deps[*]}" -eq 0 ]; then
    log 3 "Validated required dependencies: ${deps[*]}"
    return 0
  else
    log 1 "Missing required dependencies: ${_ct_highlight}${missing_deps[*]}${_cr}"
    return 1
  fi
}

Was having the same issues but the solution dsmithhayes posted worked for me. Just edit the nord.sh at lines 269-270 to match the first two declare statements that dsmithhayes has.

https://github.com/nordtheme/gnome-terminal/blob/develop/src/nord.sh

Hi @dontbejeff 👋, thanks for your contribution 👍
The shell parameters accidentally slipped in during the repository migration, but the changes for the actually required changes for the affected code lines did not.
Thanks to @dsmithhayes who already submitted #41 which fixes the lines that only existed on my local system.