shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

Unquote variable false negative in brace expansion in array

Open A4-Tacks opened this issue 2 months ago • 0 comments

For bugs with existing features

  • Rule Id: SC2206
  • My shellcheck version: 0.10.0
  • [x] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • [ ] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

Here's a snippet or screenshot that shows the problem:

#!/bin/bash
_x=({$VAR,$VAR})

Here's what shellcheck currently says:

No says

Here's what I wanted or expected to see:

_x=({$VAR,$VAR})
     ^--^ SC2206 (warning): Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
          ^--^ SC2206 (warning): Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.

A4-Tacks avatar Nov 02 '25 05:11 A4-Tacks