Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
1 to 3 of 3
Your bash scripts looks almost correct, there's just one small caveat in bash. In bash, elements of an array (such as $WRITTEN_FILES) are separated using a variable called $IFS (internal field separator), which is set to whitespace (space, tab, and newline). Thus, all files which include a space are split. Thus, you need to set the IFS environment variable to line breaks only (see code) and reset it later (our own post-processing scripts do this already). The code also includes two lines which remove empty paragraphs (the line with the sed and the mv afterwards), which may look really nerdy but is the easiest way to do it.
# Change to export directory.
# Save field separator, set field separator to line breaks.
IFS=$(echo -en "\n\b")
# Iterate over all exported files.
for FILE in $WRITTEN_FILES
# Delete empty paragraphs, write to temporary file.
sed '/\<p\>[ \t]*\<\/p\>$/d' "$FILE" > "$FILE".old
# Move temporary file to original file.
mv "$FILE".old "$FILE"
# Restore field separator.