diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-21 23:42:15 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-21 23:42:15 +0100 |
| commit | 17df35dc088c9b1b159c2b78d8330fa9cc9a672a (patch) | |
| tree | 052205953f7f11a9ea847a9b4d238f6acdbc25b8 /newnote | |
| parent | d127601c83c1a30063b76eb89bf0d9a32ed435b9 (diff) | |
| download | chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.gz chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.bz2 chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.zip | |
reformat most scripts
Diffstat (limited to 'newnote')
| -rwxr-xr-x | newnote | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -4,20 +4,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" |
