0

Im running Chrome OS in dev mode, and I am creating a bash file. The code looks like so:

echo -n "Username: "
read username: "
if [ $username == "mycroft" ]; then
    echo "Correct!"
fi

My problem is that when I run the code in crosh with /bin/sh ./login.sh, after I type in mycroft, I get this error:

[: 4: mycroft: unexpected operator

What did I do wrong?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81

1 Answers1

0

Your problem is on the second line

echo -n "Username: "
read username
if [ $username = "mycroft" ]; then
  echo "Correct!"
fi
user997836
  • 51
  • 5
  • Well, [according to the OP](http://stackoverflow.com/questions/24869727/chrome-os-bash-script-if-statement-error#comment38630436_24869727) the code in the question is not the actual code he is using, so it is rather difficult to tell when is the real issue in question. – user000001 Jul 22 '14 at 13:00