about summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_rm7
1 files changed, 4 insertions, 3 deletions
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 21b10d3f6..20f44afc5 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -33,10 +33,11 @@ _arguments -C $opts \
 case $state in
   (file)
     declare -a ignored
-    if ((CURRENT > 1)); then
-      ignored=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    ignored=()
+    ((CURRENT > 1)) &&
+      ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    ((CURRENT < $#line)) &&
       ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
-    fi
     _files -F ignored && ret=0
     ;;
 esac