Resolve shellcheck SC2129 use {...} >> file 18/62818/2
authorThanh Ha <zxiiro@gmail.com>
Thu, 16 Jan 2020 02:26:37 +0000 (12:26 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Thu, 16 Jan 2020 02:26:37 +0000 (12:26 +1000)
SC2129: Consider using { cmd1; cmd2; } >> file instead of
individual redirects.

Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: Ib7327c9f5867379654ada6b89d415321fe9fc89a
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
shell/jenkins-configure-clouds.sh

index 20092ad..8f7b3a8 100644 (file)
@@ -327,11 +327,14 @@ for silo in $silos; do
         mkdir -p "$(dirname "$insert_file")"
         rm -f "$insert_file"
 
-        echo "" >> "$insert_file"
-        echo "//////////////////////////////////////////////////" >> "$insert_file"
-        echo "// Cloud config for $(basename "$cloud")" >> "$insert_file"
-        echo "//////////////////////////////////////////////////" >> "$insert_file"
-        echo "" >> "$insert_file"
+        {
+            echo ""
+            echo "//////////////////////////////////////////////////"
+            echo "// Cloud config for $(basename "$cloud")"
+            echo "//////////////////////////////////////////////////"
+            echo ""
+        } >> "$insert_file"
+
 
         echo "templates = []" >> "$insert_file"
         mapfile -t templates < <(find "$cfg_dir" -maxdepth 1 -not -type d -not -name "cloud.cfg")