diff mbox series

[PATCHv2,3/4] base-files/functions.sh: replace ^ with ! in []

Message ID 20201015055827.29410-3-rosenp@gmail.com
State Accepted
Headers show
Series [PATCHv2,1/4] base-files/functions.sh: read grep output by line | expand

Commit Message

Rosen Penev Oct. 15, 2020, 5:58 a.m. UTC
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>
---
 package/base-files/files/lib/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 61aa87b2dd..598e283b1e 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -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}}\"";;