OSDN Git Service

fix rm bug
authorpaperbenni <paperbenni@gmail.com>
Tue, 2 Jun 2020 16:57:44 +0000 (18:57 +0200)
committerpaperbenni <paperbenni@gmail.com>
Tue, 2 Jun 2020 16:57:44 +0000 (18:57 +0200)
programs/quickmenu

index dd494fc..a0f35eb 100755 (executable)
@@ -62,7 +62,11 @@ new category' | instantmenu -bw 4 -C -l 7 -w 300)"
         fi
 
         if imenu -c "remove $REMOVECHOICE"; then
-            rm "$REMOVECHOICE"
+            if [ -d $REMOVECHOICE ]; then
+                rm -rf "$REMOVECHOICE"
+            else
+                rm "$REMOVECHOICE"
+            fi
         fi
 
         ;;
@@ -95,11 +99,13 @@ edit script' | imenu -l)"
     edit*)
         echo "editing existing entry"
         EDITCHOICE="$(ls -p | instantmenu -bw 4 -C -l 7 -w 300)"
+        [ -z "$EDITCHOICE" ] && exit
         if [ -d "$EDITCHOICE" ]; then
             imenu -m "selection is not a script"
             exit
         elif ! [ -e "$EDITCHOICE" ]; then
             imenu -m "selection $EDITCHOICE invalid"
+            exit
         fi
         urxvt -e nvim -c ":e $(realpath $EDITCHOICE)"
         ;;