Fix shellcheck errors and warnings

Fixes all shellcheck issues identified in the CI pipeline:

Critical Fix

  • SC2168: Fixed local keyword used outside function (line 358) - moved variable declaration inside the conditional block

Code Quality Improvements

  • SC2155 (23 occurrences): Separated variable declarations from assignments to properly handle return values and avoid masking errors
  • SC2001 (2 occurrences): Replaced sed with bash parameter expansion for simple string substitutions (more efficient)
  • SC2086: Added quotes around $PATH to prevent globbing
  • SC2016: Fixed variable expansion in install.sh by using double quotes

All changes maintain the same functionality while following shellcheck best practices for safer and more maintainable shell scripts.

Merge request reports

Loading