0

This question already has an answer here:

teams.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

I keep getting the error:

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

I'm not sure what I'm doing wrong with my code.

marked as duplicate by Jeff Schaller, user79743, Jakuje, don_crissti, muru Feb 17 '16 at 19:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

You are missing space around [ and ]. It should looks like this:

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.