]> Sergey Matveev's repositories - nnn.git/commitdiff
slightly improve and optimize n.fish
authorPatrick <patrickf3139@gmail.com>
Fri, 16 Sep 2022 00:11:34 +0000 (17:11 -0700)
committerGitHub <noreply@github.com>
Fri, 16 Sep 2022 00:11:34 +0000 (17:11 -0700)
The expr is redundant because `test -ge` treats strings as numbers already.

misc/quitcd/quitcd.fish

index c9902080bd4e0acd4b473f5e47cb83928664cc06..12d3b6d2b473ea4f216ada6ce568ced52f33217d 100644 (file)
@@ -4,11 +4,9 @@
 
 function n --wraps nnn --description 'support nnn quit and change directory'
     # Block nesting of nnn in subshells
-    if test -n "$NNNLVL"
-        if [ (expr $NNNLVL + 0) -ge 1 ]
-            echo "nnn is already running"
-            return
-        end
+    if test -n "$NNNLVL" && test $NNNLVL -ge 1
+        echo "nnn is already running"
+        return
     end
 
     # The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)