]> Sergey Matveev's repositories - nnn.git/commitdiff
check if $entry is fullpath or not
authorNRK <nrk@disroot.org>
Mon, 1 Nov 2021 08:05:18 +0000 (14:05 +0600)
committerNRK <nrk@disroot.org>
Mon, 1 Nov 2021 08:05:18 +0000 (14:05 +0600)
plugins/fzopen

index d26e96e3785186780d1935adfa9190eeee95ddb8..013413fb8b6d4ab09e1853d9b0fae567187a9b2f 100755 (executable)
@@ -41,10 +41,14 @@ fi
 # Check for picker mode
 if [ "$3" ]; then
     if [ "$entry" ]; then
+        case "$entry" in
+            /*) fullpath="${2}/$entry" ;;
+            *)  fullpath="$entry" ;;
+        esac
         if [ "-" = "$3" ]; then
-            printf "%s\n" "${2}/$entry"
+            printf "%s\n" "$fullpath"
         else
-            printf "%s\n" "${2}/$entry" > "$3"
+            printf "%s\n" "$fullpath" > "$3"
         fi
 
         # Tell `nnn` to clear its internal selection