base-files: functions.sh: replace [^...] with [!...] in case
authorRosen Penev <rosenp@gmail.com>
Thu, 15 Oct 2020 05:58:26 +0000 (22:58 -0700)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Wed, 25 Nov 2020 16:22:39 +0000 (17:22 +0100)
Strictly speaking, ash does not support it.

From https://wiki.ubuntu.com/DashAsBinSh#A.5B.5E.5D

Not to be confused by sed's and other program's regular expression
syntax. Uses of [^...] in case (parameter/word expansion in general) need
to be replaced with [!...].

Found with shellcheck: https://github.com/koalaman/shellcheck/wiki/SC2169

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
package/base-files/files/lib/functions.sh

index 7da0c872fa2b8d5a5896334ddebbc5b7d7f30308..ee4ad1af8398517c056f4051eb48651fecf695d2 100755 (executable)
@@ -108,7 +108,7 @@ config_unset() {
 # config_get <section> <option>
 config_get() {
        case "$2${3:-$1}" in
-               *[^A-Za-z0-9_]*) : ;;
+               *[!A-Za-z0-9_]*) : ;;
                *)
                        case "$3" in
                                "") eval echo "\"\${CONFIG_${1}_${2}:-\${4}}\"";;