diff --git a/SC2184.md b/SC2184.md index 70e83ef..84c9647 100644 --- a/SC2184.md +++ b/SC2184.md @@ -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. +Note that you can unset element using variable for index name like this: + +```sh +unset 'foo[$var]' +``` + ### 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`. \ No newline at end of file