move to blog dir a proper if block instead of && chain

This commit is contained in:
James Tomasino 2020-10-29 00:03:46 +00:00
parent d0e7d60d93
commit 554ad1615b
1 changed files with 6 additions and 4 deletions

10
bb.sh
View File

@ -891,7 +891,7 @@ make_gophermap() {
EOF EOF
chmod +x "${HOME}/public_html/blog/${gophermap}" chmod +x "${HOME}/public_html/blog/${gophermap}"
fi fi
chmod 644 ./*.md chmod 644 "./*.md"
} }
make_gemini() { make_gemini() {
@ -1111,9 +1111,11 @@ date_version_detect() {
# $2 file name of a draft to continue editing (optional) # $2 file name of a draft to continue editing (optional)
do_main() { do_main() {
# make sure we're in the right directory # make sure we're in the right directory
[ "$(pwd)" != "$HOME/public_html/blog" ] && if [ "$(pwd)" != "$HOME/public_html/blog" ]; then
echo "you're not in your blog directory. moving you there now" && \ echo "you're not in your blog directory. moving you there now"
mkdir -p "$HOME/public_html/blog" && cd "$HOME/public_html/blog" || exit 1 mkdir -p "$HOME/public_html/blog"
cd "$HOME/public_html/blog" || exit 1
fi
# Detect if using BSD date or GNU date # Detect if using BSD date or GNU date
date_version_detect date_version_detect