]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
script/ceph-backport.sh: fix sanity test of issue number
authorKefu Chai <kchai@redhat.com>
Thu, 28 Mar 2019 03:57:21 +0000 (11:57 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 28 Mar 2019 04:14:07 +0000 (12:14 +0800)
* no need for checking negative numbers
* use regex for matching the number instead of using bash's pattern
  matching, otherwise i have
./ceph-backport.sh: line 79: syntax error in conditional expression:
unexpected token `('
  the pattern matching works fine if i use it in command line, but
  it fails to work in shell script.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/script/ceph-backport.sh

index bc873a08dcc06aa6257aed0da5442f882ad47a6c..0022393cffd5bdf3ddb547d60c28c3f914162e83 100755 (executable)
@@ -71,7 +71,7 @@ function usage () {
     exit 1
 }
 
-[[ $1 != ?(-)+([0-9]) ]] && usage
+[[ $1 =~ ^[0-9]+$ ]] || usage
 issue=$1
 echo "Backport issue: $issue"