printf '%s' "$CONTENT" > "$FILENAME" will strip the final newline from wiki pages It might be worth using printf '%s\n' instead