export GNUINE_HOME=$HOME/projects/ function cs { local dest current if test -n "$1"; then cd "$GNUINE_HOME/$1" fi } function _cs_scandir { local base ext base=$1 ext=$2 if [ -d $base ]; then for d in `ls $base`; do if [ -d $base/$d ]; then dirs="$dirs $ext$d/" fi done fi } function _cs() { local cur dirs _cs_scandir "$GNUINE_HOME" COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" COMPREPLY=( $(compgen -W "${dirs}" -- ${cur}) ) } complete -F _cs cs