Created
January 29, 2013 13:46
-
-
Save sanchitgangwar/4664351 to your computer and use it in GitHub Desktop.
Inline file search - bash completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_is() | |
{ | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
if [[ ${cur} == * ]]; then | |
COMPREPLY=( $(find ./ -maxdepth 1 -iname "*${cur}*" | cut -d '/' -f 2) ) | |
return 0 | |
fi | |
} | |
complete -F _is is |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment