diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-18 11:44:26 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-18 11:44:26 +0100 |
| commit | 83954961af8b6337da100e038561f2fd975ac1fe (patch) | |
| tree | 33a45dbf91cc4c0b8975287b9537db8aa272505f /newnote | |
| parent | afd02bfcce54e3252d356f34c25a155c855f3612 (diff) | |
| download | chadscripts-master.tar.gz chadscripts-master.tar.bz2 chadscripts-master.zip | |
Diffstat (limited to 'newnote')
| -rwxr-xr-x | newnote | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -3,20 +3,20 @@ dir="$OBSIDIAN_HOME" 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 + 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 + echo "Usage: newnote <note-name>" >&2 + exit 1 } newnote "$1" |
