|
1 | | -#!/usr/bin/zsh |
| 1 | +#!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | ################################################################################################## |
4 | 4 | # This script downloads the latest JSON checklist in https://github.com/Azure/review-checklists |
|
197 | 197 | if [[ "$debug" == "yes" ]]; then echo "DEBUG: Extracting information from JSON..."; fi |
198 | 198 | if [[ -n "$category_name" ]] |
199 | 199 | then |
200 | | - graph_query_list=$(print -r "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .graph') |
201 | | - category_list=$(print -r "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .category') |
202 | | - text_list=$(print -r "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .text') |
203 | | - guid_list=$(print -r "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .guid') |
| 200 | + graph_query_list=$(echo -E "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .graph') |
| 201 | + category_list=$(echo -E "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .category') |
| 202 | + text_list=$(echo -E "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .text') |
| 203 | + guid_list=$(echo -E "$checklist_json" | jq -r '.items[] | select(.category=="'$category_name'") | .guid') |
204 | 204 | if [[ -z "$text_list" ]]; then |
205 | 205 | echo "ERROR: error processing JSON file, please verify the syntax" |
206 | 206 | exit |
207 | 207 | fi |
208 | 208 | if [[ "$debug" == "yes" ]]; then echo "DEBUG: $(echo $text_list | wc -l) tests found in the checklist for category ${category_name}."; fi |
209 | 209 | else |
210 | | - graph_query_list=$(print -r "$checklist_json" | jq -r '.items[] | .graph') |
211 | | - category_list=$(print -r "$checklist_json" | jq -r '.items[] | .category') |
212 | | - text_list=$(print -r "$checklist_json" | jq -r '.items[] | .text') |
213 | | - guid_list=$(print -r "$checklist_json" | jq -r '.items[] | .guid') |
| 210 | + graph_query_list=$(echo -E "$checklist_json" | jq -r '.items[] | .graph') |
| 211 | + category_list=$(echo -E "$checklist_json" | jq -r '.items[] | .category') |
| 212 | + text_list=$(echo -E "$checklist_json" | jq -r '.items[] | .text') |
| 213 | + guid_list=$(echo -E "$checklist_json" | jq -r '.items[] | .guid') |
214 | 214 | if [[ -z "$text_list" ]]; then |
215 | 215 | echo "ERROR: error processing JSON file, please verify the syntax" |
216 | 216 | exit |
@@ -284,7 +284,7 @@ while IFS= read -r graph_query; do |
284 | 284 | graph_query=$(echo "$graph_query") # Fix for backslashes |
285 | 285 | if [[ "$debug" == "yes" ]]; then echo "DEBUG: Running query \"$graph_query\"..."; fi |
286 | 286 | # The query should return one line per result. Fields ID and Compliant and mandatory |
287 | | - query_result=$(az graph query -q "$graph_query" ${(z)mg_option} -o tsv 2>$error_file --query 'data[].[id,compliant]' | sort -u) |
| 287 | + query_result=$(az graph query -q "$graph_query" ${mg_option} -o tsv 2>$error_file --query 'data[].[id,compliant]' | sort -u) |
288 | 288 | rm $error_file 2>/dev/null; touch $error_file |
289 | 289 | while IFS= read -r result |
290 | 290 | do |
|
0 commit comments