]> git.tuebingen.mpg.de Git - gsu.git/commitdiff
subcommand: Use POSIX compatible command regex.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 5 Mar 2017 18:55:13 +0000 (19:55 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 15 Apr 2017 15:45:21 +0000 (17:45 +0200)
The POSIX way to ask for one or more matches of the preceeding atom
is {1,} while the plus character is a non-portable shortcut.

Note that since the closing brace of the regex bound is inside
parameter expansion, we need to escape it with a backslash while the
opening brace must not be escaped.

subcommand

index 261e35f5e39b6f377529c24a136427106d6301cb..ca546bd1617074d86813135f54c9dc2f7f7e5873 100644 (file)
@@ -25,7 +25,7 @@ _gsu_usage()
 # exactly one parenthesized subexpression for matching the command name.
 _gsu_get_command_regex()
 {
 # exactly one parenthesized subexpression for matching the command name.
 _gsu_get_command_regex()
 {
-       local cmd="${1:-[-a-zA-Z_0-9]+}"
+       local cmd="${1:-[-a-zA-Z_0-9]{1,\}}"
        result="^com_($cmd)\(\)"
 }
 
        result="^com_($cmd)\(\)"
 }