Use read -a for safety

This commit is contained in:
2024-12-06 01:32:07 +08:00
parent a9e4013969
commit 3282ef2a35

View File

@ -27,7 +27,10 @@ INPUT_RULES=$(cat input-rules)
do do
# Loop through rules and build all the KVs # Loop through rules and build all the KVs
DAG_GREP_EXPR=$( printf "%s" "$CACHED_LINE" | paste -s -d '|' ) DAG_GREP_EXPR=$( printf "%s" "$CACHED_LINE" | paste -s -d '|' )
KV_ARRAY=( $( < input-rules grep -E "($DAG_GREP_EXPR)\\|($DAG_GREP_EXPR)" | tr '|' ' ' | paste -s -d ' ') ) read -r -a KV_ARRAY <<< "$(
< input-rules grep -E "($DAG_GREP_EXPR)\\|($DAG_GREP_EXPR)" |
tr '|' ' ' |
paste -s -d ' ')"
# Going through dependencies to find final key # Going through dependencies to find final key
KEY=${KV_ARRAY[0]} KEY=${KV_ARRAY[0]}
while true while true