summaryrefslogtreecommitdiff
path: root/newnote
diff options
context:
space:
mode:
Diffstat (limited to 'newnote')
-rwxr-xr-xnewnote22
1 files changed, 14 insertions, 8 deletions
diff --git a/newnote b/newnote
index c1b1835..ddf5c1b 100755
--- a/newnote
+++ b/newnote
@@ -2,16 +2,22 @@
dir="$HOME/.obsidian"
-newnote () {
- file="$dir/$1.md"
- [ -f "$file" ] && { echo "Note with the same name already exists, exiting" >&2; exit 1 ;}
- touch "$file" && "$EDITOR" +2 "$file"
- if [ "$( wc -l "$file" | awk '{print $1}' )" -lt 2 ]; then
- rm -f "$file"
- fi
+newnote() {
+ file="$dir/$1.md"
+ [ -f "$file" ] && {
+ echo "Note with the same name already exists, exiting" >&2
+ exit 1
+ }
+ touch "$file" && "$EDITOR" +2 "$file"
+ if [ "$(wc -l "$file" | awk '{print $1}')" -lt 2 ]; then
+ rm -f "$file"
+ fi
}
-[ "$#" -ne 1 ] && { echo "Usage: newnote <note-name>" >&2; exit 1; }
+[ "$#" -ne 1 ] && {
+ echo "Usage: newnote <note-name>" >&2
+ exit 1
+}
newnote "$1"
exit 0