alias cq='function _cq(){ local toDir local dirNumber local searchPattern="${1}" local searchDepth="${2}" if [ -z "$searchDepth" ]; then searchDepth="1" fi if [[ "${searchPattern}" == */ ]]; then searchPattern=${searchPattern::-1} fi read -d " " -r -a toDir <<< $(find -maxdepth "${searchDepth}" -type d | grep -iE "${searchPattern}" | grep -vi clone) if [ ${#toDir[@]} == 0 ]; then echo "... found nothing for pattern ${searchPattern}" elif [ ${#toDir[@]} == 1 ]; then cd "${toDir[0]}" else for i in $(seq ${#toDir[@]}); do echo "[$i] ${toDir[$i-1]}" done read -p "Type number: " dirNumber cd "${toDir[$dirNumber-1]}" fi };_cq'