Use a more exact grep for fetching cfg options 04/11504/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 21 Jun 2018 21:21:07 +0000 (17:21 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 21 Jun 2018 21:33:42 +0000 (17:33 -0400)
Use an exact grep command to fetch cfg options so that an
option containing the same characters in another option does
not get parsed accidently.

Change-Id: I40f3fd883ab5245da35b911aef3fe9edbda88fe2
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
shell/jenkins-configure-clouds.sh

index 3f7dd6a..ed03f5c 100644 (file)
@@ -63,7 +63,7 @@ get_cfg() {
         exit 1
     fi
 
-    cfg=$(grep "${setting^^}" "$cfg_file" | tail -1 | awk -F'=' '{print $2}')
+    cfg=$(grep "^${setting^^}=" "$cfg_file" | tail -1 | awk -F'=' '{print $2}')
     cfg=${cfg:-"$default"}
     echo "$cfg"
 }