From d4a11664f8fb9a3506791e9138eee6bd1b8e7200 Mon Sep 17 00:00:00 2001 From: creme Date: Fri, 29 Nov 2019 11:29:45 +0100 Subject: [PATCH] small envs_user_updated.sh optimations --- bin/envs.net/envs_user_updated.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/envs.net/envs_user_updated.sh b/bin/envs.net/envs_user_updated.sh index 237a5a3..4335137 100755 --- a/bin/envs.net/envs_user_updated.sh +++ b/bin/envs.net/envs_user_updated.sh @@ -183,15 +183,15 @@ EOM EOM else # continue user def. array - if ! [[ "$field_count" -eq '0' ]]; then - cat << EOM >> "$TMP_JSON" + cat << EOM >> "$TMP_JSON" "${line_to_set[$field]}", EOM - # end of user def. array - else + if [[ "$field_count" -eq '0' ]]; then + # end of user def. array + # remove trailing ',' on last user entry unset field_in_progress + sed -i '$ s/,$//' "$TMP_JSON" cat << EOM >> "$TMP_JSON" - "${line_to_set[$field]}" ], EOM fi