Skip to content

Commit

Permalink
exit1 on failure to create NOTES_DIRECTORY
Browse files Browse the repository at this point in the history
  • Loading branch information
rmnull authored and rmnull committed Mar 17, 2018
1 parent 7352030 commit 4096451
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions notes
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ notes_dir="${configured_dir:-$HOME/notes}"
escaped_notes_dir="$(printf "$notes_dir" | sed -e 's/[]\/$*.^|[]/\\&/g')"

# Make sure the notes directory actually exists, and create it if it doesn't
if [ ! -d "$notes_dir" ]; then
mkdir -p "$notes_dir"
# if [ ! -d "$notes_dir" ]; then
# mkdir man page says "create the Dir(s) if they donot already exist"
if ! $(mkdir -p "$notes_dir"); then
echo "set \$NOTES_DIRECTORY to a different location" >&2
exit 1
fi
# fi

# If no $EDITOR, look for `editor` (symlink on debian/ubuntu/etc)
if [ -z "$EDITOR" ] && type editor &>/dev/null; then
Expand Down

0 comments on commit 4096451

Please sign in to comment.