mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2184 (markdown)
@@ -19,6 +19,12 @@ In the problematic code, having a file called `food` in the current directory wi
|
|||||||
|
|
||||||
Quoting so that the `[..]` is passed literally to `unset` solves the issue.
|
Quoting so that the `[..]` is passed literally to `unset` solves the issue.
|
||||||
|
|
||||||
|
Note that you can unset element using variable for index name like this:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
unset 'foo[$var]'
|
||||||
|
```
|
||||||
|
|
||||||
### Exceptions:
|
### Exceptions:
|
||||||
|
|
||||||
If you know that pathname expansion is disabled you can ignore this message. `set -o noglob` (and variations like invoking the script with `#!/bin/bash -f`) will prevent glob expansion of arguments to `unset`.
|
If you know that pathname expansion is disabled you can ignore this message. `set -o noglob` (and variations like invoking the script with `#!/bin/bash -f`) will prevent glob expansion of arguments to `unset`.
|
Reference in New Issue
Block a user