bucle si/entonces usando `cat`

bucle si/entonces usando `cat`

equipos.txt:

Bills
Jets
Dolphin
Patriots

.

for team in `cat teams.txt`
do
    if ["$team" == "Bills"]
    then
        echo "$team hired Rex Ryan as coach"
    fi
    echo "$team Nation"
done

Sigo recibiendo el error:

teams.sh: line 5: [Bills: command not found

No estoy seguro de qué estoy haciendo mal con mi código.

Respuesta1

Te falta espacio alrededor de [y]. Debería verse así:

for team in `cat teams.txt`
do
    if [ "$team" == "Bills" ]
    then
        echo "$team hired Rex Ryan as coach"
    fi
    echo "$team Nation"
done

información relacionada