From 423eba2213d55e4b524313b9ef16d4bea71bdd18 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Fri, 11 Oct 2024 10:33:18 -0400 Subject: [PATCH] Added comment to explain weird use of associative array syntax --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 78842cd..4b31af2 100755 --- a/build.sh +++ b/build.sh @@ -108,7 +108,8 @@ add_header_and_footer() { cp "$BASE_PATH/header.html" "$BASE_PATH/temp/$parent_dir/temp_header.html" # Check for relevant metadata, and perform corresponding action - if [[ ! -v "meta_array["date"]" ]]; then # If there is no date + # This syntax is intended (although it doesn't follow typical Bash array syntax). See https://stackoverflow.com/a/45385463 for more info. + if [[ ! -v "meta_array[date]" ]]; then # If there is no date sed -i '$ d' "$BASE_PATH/temp/$parent_dir/temp_header.html" # remove the 'date published' section of the header fi