From a7f3298359f9662cec630faa124d3be4f7575511 Mon Sep 17 00:00:00 2001 From: David Ruan Date: Tue, 3 Mar 2026 15:53:05 +0800 Subject: [PATCH] fix: work around bash 3.2 heredoc bug causing unbound variable error macOS ships bash 3.2 which has a bug where `"$(cat <<'DELIM'...DELIM)"` incorrectly expands variables after a `case/esac` block inside the single-quoted heredoc. This caused `set -u` to trigger "account: unbound variable" during installation. Replace `content="$(cat <<'EOF'...EOF)"` with `IFS= read -r -d '' content <<'EOF' || true` in both write_ccm_wrapper and write_ccc_wrapper to avoid the command substitution entirely. --- install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index e2c2c02..18c5c06 100755 --- a/install.sh +++ b/install.sh @@ -481,7 +481,7 @@ exec "$CCM_SH" "$@" EOF else local content - content="$(cat <<'EOF' + IFS= read -r -d '' content <<'EOF' || true #!/usr/bin/env bash set -euo pipefail CCM_SH="__DATA_DIR__/ccm.sh" @@ -491,7 +491,6 @@ if [[ ! -f "$CCM_SH" ]]; then fi exec "$CCM_SH" "$@" EOF -)" content="${content//__DATA_DIR__/$data_dir}" printf '%s\n' "$content" > "$target" fi @@ -631,7 +630,7 @@ fi EOF else local content - content="$(cat <<'EOF' + IFS= read -r -d '' content <<'EOF' || true #!/usr/bin/env bash set -euo pipefail CCM="__DATA_DIR__/ccm.sh" @@ -751,7 +750,6 @@ else exec claude "${claude_args[@]}" fi EOF -)" content="${content//__DATA_DIR__/$data_dir}" printf '%s\n' "$content" > "$target" fi