0

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.

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