главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
path: root/bb.sh
diff options
context:
space:
mode:
authorAlexey Shpakovsky <alexey@shpakovsky.ru>2014-03-18 23:11:14 +0100
committerAlexey Shpakovsky <alexey@shpakovsky.ru>2014-03-18 23:50:25 +0100
commit1dea4161dac346a1f36c80dc18d25ad474132c71 (patch)
treeecd5868530f98c5667b4cd161dc8ff6574cb49a9 /bb.sh
parent74537033f3f144f6360d338ecd99764b85f82f10 (diff)
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
Diffstat (limited to 'bb.sh')
-rwxr-xr-xbb.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/bb.sh b/bb.sh
index 9097a61..bdafb17 100755
--- a/bb.sh
+++ b/bb.sh
@@ -584,7 +584,9 @@ EOF
chmod 600 "$TMPFILE"
post_status="E"
+ filename=""
while [ "$post_status" != "p" ] && [ "$post_status" != "P" ]; do
+ [ "$filename" ] && rm "$filename" # Delete the generated html file, if any
$EDITOR "$TMPFILE"
if [[ "$fmt" == "md" ]]; then
html_from_md="$(markdown "$TMPFILE")"
@@ -622,9 +624,6 @@ EOF
echo "Saved your draft as '$draft'"
exit
fi
- if [[ "$post_status" == "e" ]] || [[ "$post_status" == "E" ]]; then
- rm "$filename" # Delete the html file as it will be generated again
- fi
done
rm "$TMPFILE"