diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
commit | 95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /completions/crontab | |
parent | 019f3cc463db63abc6460f97deb488deec43840b (diff) | |
download | bash-completion-95623d39d6029ba78ec96ad5ea08e9ac12629b91.tar.gz |
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'completions/crontab')
-rw-r--r-- | completions/crontab | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/completions/crontab b/completions/crontab index a5e5cc58..cac78533 100644 --- a/completions/crontab +++ b/completions/crontab @@ -12,13 +12,13 @@ _crontab() ;; esac - local -A opts=( [-u]= [-l]= [-r]= [-e]= ) + local -A opts=([-u]="" [-l]="" [-r]="" [-e]="") [[ $OSTYPE == *linux* ]] && opts[-i]= [[ -d /sys/fs/selinux || -d /selinux ]] && opts[-s]= local i - for (( i=0; i < ${#words[@]}-1; i++ )); do - [[ ${words[i]} ]] && unset "opts[${words[i]}]" + for i in "${!words[@]}"; do + [[ ${words[i]} && $i -ne $cword ]] && unset "opts[${words[i]}]" case "${words[i]}" in -l) unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]' @@ -35,14 +35,14 @@ _crontab() esac done - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '${!opts[@]}' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '${!opts[@]}' -- "$cur")) return fi # do filenames only if we did not have -l, -r, or -e - [[ "${words[*]}" == *\ -[lre]* ]] || _filedir + [[ ${words[*]} == *\ -[lre]* ]] || _filedir } && -complete -F _crontab crontab + complete -F _crontab crontab # ex: filetype=sh |