Skip to content

Example Project ./setup.sh: line 38: MISE_ARGS[@]: unbound variable #927

Description

@devahmedshendy

When I run setup script on macOS, I get this error:

 ./setup.sh: line 38: MISE_ARGS[@]: unbound variable 

I figured out that this error only happens in older versions of bash (mine is 3.2.57, which is the macOS default system Bash).

I tried following reproduction script:

#!/usr/bin/env bash
set -u

# Declare an empty array
MISE_ARGS=()

echo "Testing array expansion..."
echo "Arguments: ${MISE_ARGS[@]}" 
echo "Success! No error occurred."

It fails with an error on my Bash 3.2.57, but works on newer versions (e.g., Bash 5.x).

Is it a requirement to have newer bash version so I - somehow - install and manage newer versions of bash.
Or this requires setup.sh to provide backward compatibility? it just needs to be from "${MISE_ARGS[@]}" to ${MISE_ARGS[@]+"${MISE_ARGS[@]}"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: exampleExample apps, previews, sample projects, screenshots, or demo assets.area: toolingDeveloper tooling, package manifests, Tuist, scripts, formatting, or release tooling.platform: macOSmacOS-specific behavior or support.type: bugSomething is not working correctly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions