_athrun () { COMPREPLY=() local cur="${COMP_WORDS[$COMP_CWORD]}" if [ $COMP_CWORD -eq 1 ]; then local IFS=$'\n' COMPREPLY=( $(cd /mit 2>/dev/null && compgen -f -- "$cur") ) elif [ $COMP_CWORD -eq 2 ]; then local IFS=$'\n' COMPREPLY=( $(dir="$(eval "athdir /mit/${COMP_WORDS[1]}")" && \ cd "$dir" && compgen -f -- "$cur") ) else COMP_WORDS[1]=-dummy _command fi } complete -F _athrun $filenames athrun