View difference between Paste ID: mR8y1Rks and Cw91aYA8
SHOW: | | - or go back to the newest paste.
1
_ct()
2
{
3-
    local abs_path="$(pwd)"
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")"
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)"
12+
            abs_path="$( dirname $abs_path )"
13
        fi  
14
    done
15
    COMPREPLY=( $target )
16
} && complete -F _ct ct