Added comment to explain weird use of associative array syntax
This commit is contained in:
3
build.sh
3
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
|
||||
|
||||
|
Reference in New Issue
Block a user