nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3c69e6ccac5fece5089d816de7a36fc1eb3f74e6
parent f1791af2ab07fbf2aac940d8ca71b2f0e78a0090
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Sun, 12 Jan 2020 00:26:03 +0530

Guard against empty

Diffstat:
Mmisc/quitcd/quitcd.bash | 2+-
Mmisc/quitcd/quitcd.fish | 8+++++---
Mmisc/quitcd/quitcd.zsh | 2+-
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/misc/quitcd/quitcd.bash b/misc/quitcd/quitcd.bash @@ -1,7 +1,7 @@ n () { # Block nesting of nnn in subshells - if [ "${NNNLVL:-0}" -ge 1 ]; then + if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then echo "nnn is already running" return fi diff --git a/misc/quitcd/quitcd.fish b/misc/quitcd/quitcd.fish @@ -4,9 +4,11 @@ function n --description 'support nnn quit and change directory' # Block nesting of nnn in subshells - if [ (expr $NNNLVL + 0) -ge 1 ] - echo "nnn is already running" - return + if test -n NNNLVL + if [ (expr $NNNLVL + 0) -ge 1 ] + echo "nnn is already running" + return + end end # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) diff --git a/misc/quitcd/quitcd.zsh b/misc/quitcd/quitcd.zsh @@ -1,7 +1,7 @@ n () { # Block nesting of nnn in subshells - if [ "${NNNLVL:-0}" -ge 1 ]; then + if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then echo "nnn is already running" return fi