Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _ct()
- {
- local abs_path="$( pwd )"
- local test_target=""
- local target=""
- while [ \( ! "/" = $abs_path \) -a \( -z "$target" \) ]; do
- test_target="$( basename "$abs_path" )"
- if [[ "$test_target" =~ ${COMP_WORDS[$COMP_CWORD]} ]]; then
- target="$test_target"
- else
- abs_path="$( dirname $abs_path )"
- fi
- done
- COMPREPLY=( $target )
- } && complete -F _ct ct
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement