delete generated HTML file before generating new one, not at the bottom
Bug was that when confirming "[E]dit again" by providing an empty string, the file wasn't deleted we could as well do if [ "$post_status" != "p" ] && [ "$post_status" != "P" ] but this way is IMO cleaner
This commit is contained in:
parent
74537033f3
commit
1dea4161da
1 changed files with 2 additions and 3 deletions
5
bb.sh
5
bb.sh
|
@ -584,7 +584,9 @@ EOF
|
||||||
chmod 600 "$TMPFILE"
|
chmod 600 "$TMPFILE"
|
||||||
|
|
||||||
post_status="E"
|
post_status="E"
|
||||||
|
filename=""
|
||||||
while [ "$post_status" != "p" ] && [ "$post_status" != "P" ]; do
|
while [ "$post_status" != "p" ] && [ "$post_status" != "P" ]; do
|
||||||
|
[ "$filename" ] && rm "$filename" # Delete the generated html file, if any
|
||||||
$EDITOR "$TMPFILE"
|
$EDITOR "$TMPFILE"
|
||||||
if [[ "$fmt" == "md" ]]; then
|
if [[ "$fmt" == "md" ]]; then
|
||||||
html_from_md="$(markdown "$TMPFILE")"
|
html_from_md="$(markdown "$TMPFILE")"
|
||||||
|
@ -622,9 +624,6 @@ EOF
|
||||||
echo "Saved your draft as '$draft'"
|
echo "Saved your draft as '$draft'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [[ "$post_status" == "e" ]] || [[ "$post_status" == "E" ]]; then
|
|
||||||
rm "$filename" # Delete the html file as it will be generated again
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
rm "$TMPFILE"
|
rm "$TMPFILE"
|
||||||
|
|
Loading…
Add table
Reference in a new issue