aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_completion.d/mex.bash15
1 files changed, 15 insertions, 0 deletions
diff --git a/bash/bash_completion.d/mex.bash b/bash/bash_completion.d/mex.bash
new file mode 100644
index 00000000..d25f1824
--- /dev/null
+++ b/bash/bash_completion.d/mex.bash
@@ -0,0 +1,15 @@
+# Completion setup for mex(1df), completing non-executable files in $PATH
+_mex() {
+ local -a path
+ IFS=: read -ra path < <(printf '%s\n' "$PATH")
+ local dir name
+ for dir in "${path[@]}" ; do
+ [[ -d $dir ]] || continue
+ for name in "$dir"/* ; do
+ [[ -f $name ]] || continue
+ ! [[ -x $name ]] || continue
+ COMPREPLY[${#COMPREPLY[@]}]=${name##*/}
+ done
+ done
+}
+complete -F _mex mex