Advertisement
Guest User

Untitled

a guest
Jan 12th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. _ct()
  2. {
  3.     local abs_path="$( pwd )"
  4.     local test_target=""
  5.     local target=""
  6.  
  7.     while [ \( ! "/" = $abs_path \) -a \( -z "$target" \) ]; do
  8.         test_target="$( basename "$abs_path" )"
  9.         if [[ "$test_target" =~ ${COMP_WORDS[$COMP_CWORD]} ]]; then
  10.             target="$test_target"
  11.         else
  12.             abs_path="$( dirname $abs_path )"
  13.         fi  
  14.     done
  15.     COMPREPLY=( $target )
  16. } && complete -F _ct ct
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement