From 36cabd6af5abf8f008778c6eeee9b24b6e791af7 Mon Sep 17 00:00:00 2001 From: malamut-ubuntu <32544514+malamut-ubuntu@users.noreply.github.com> Date: Tue, 1 Feb 2022 22:06:51 +0300 Subject: [PATCH] Updated SC2184 (markdown) --- SC2184.md | 6 ++++++ 1 file changed, 6 insertions(+) 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