aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/chgrp.bash
blob: 5e93ccee29ed741f587a8b1d6d6c5ed9475cb0ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Complete group names for first non-option chgrp(1) argument
_chgrp() {
    local i
    for ((i = 1; i < COMP_CWORD; i++)) ; do
        case ${COMP_WORDS[i]} in
            -*) ;;
            *) return 1 ;;
        esac
    done
    while read -r group ; do
        COMPREPLY[${#COMPREPLY[@]}]=$group
    done < <(compgen -A group -- "${COMP_WORDS[COMP_CWORD]}")
}
complete -F _chgrp -o bashdefault -o default chgrp