diff options
-rw-r--r-- | misc/quitcd/quitcd.bash | 2 | ||||
-rw-r--r-- | misc/quitcd/quitcd.fish | 8 | ||||
-rw-r--r-- | misc/quitcd/quitcd.zsh | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/misc/quitcd/quitcd.bash b/misc/quitcd/quitcd.bash index 203e613..edeb2db 100644 --- 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 index ea6a1bd..9b3061c 100644 --- 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 index 203e613..edeb2db 100644 --- 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 |