#!/bin/bash IFS=$'\n' DIR=$1 TYPE=$2 NAME=$3 cd $DIR for FIELD in $(vendor/drush/drush/drush fi ${TYPE} ${NAME} | tail -n +3 | grep -v '\-\-\-'); do NAME=$(echo $FIELD | awk '{print $1}') SECOND=$(echo $FIELD | awk '{print $2}') THIRD=$(echo $FIELD | awk '{print $3}') COUNT=$(echo $SECOND | wc -c) if [ "$COUNT" -gt 5 ]; then TYPE=$SECOND else TYPE=$THIRD fi echo "$NAME $TYPE" done