Updated SC2149 (markdown)

Eisuke Kawashima
2025-07-29 10:57:38 +09:00
parent ddd3998b36
commit aa6b230e7f

@@ -4,7 +4,7 @@ _Note: Removed in [v0.5.0 - 2018-06-01](https://github.com/koalaman/shellcheck/c
### Problematic code:
```sh
```bash
# Regular array
index=42
echo $((array[$index]))
@@ -12,7 +12,7 @@ echo $((array[$index]))
or
```sh
```bash
# Associative array
index=banana
echo $((array[$index]))
@@ -20,7 +20,7 @@ echo $((array[$index]))
### Correct code:
```
```bash
# Regular array
index=42
echo $((array[index]))
@@ -28,7 +28,7 @@ echo $((array[index]))
or
```sh
```bash
# Associative array
index=banana
echo $((array[\$index]))
@@ -40,7 +40,7 @@ For a numerically indexed array, the `$` is mostly pointless and can be removed
For associative arrays, the `$` should be escaped to avoid accidental dereferencing:
```sh
```bash
declare -A array
index='$1'
array[$index]=42