Fix bug where three editors are opened

This commit is contained in:
The Magician 2023-11-22 12:38:37 +00:00
parent 631729fe09
commit dd41951442
1 changed files with 3 additions and 3 deletions

6
nx
View File

@ -14,10 +14,10 @@ test -f "$1" && error "$1 already exists"
fullpath="$HOME/code/scripts/$1" fullpath="$HOME/code/scripts/$1"
touch "$fullpath" && chmod +x "$fullpath" touch "$fullpath" && chmod +x "$fullpath"
test -n "$EDITOR" && $EDITOR "$fullpath" test -n "$EDITOR" && $EDITOR "$fullpath" && exit 0
test -n "$VISUAL" && $VISUAL "$fullpath" test -n "$VISUAL" && $VISUAL "$fullpath" && exit 0
if command -v vi 1>/dev/null; then if command -v vi 1>/dev/null; then
vi "$fullpath" vi "$fullpath" && exit 0
else else
error "No editor program found (set \$EDITOR or \$VISUAL, or install \`vi\`)" error "No editor program found (set \$EDITOR or \$VISUAL, or install \`vi\`)"
fi fi