0
#!/bin/bash

declare  animal

echo " chose a animal: dog,mouse,fish,"
read $animal

if[[$animal ==  dog]];then echo "੯•໒꒱ "

elif[[$animal == mouse]];then echo" …ᘛ⁐̤ᕐᐷ "

elif[[$animal == fish]];then echo "ʚʘ͜͡))❨ "

fi

exit 0
JGK
  • 3,710
  • 1
  • 21
  • 26
  • Run your code through http://shellcheck.net/ and fix what it finds before asking questions here. – Charles Duffy Apr 17 '22 at 19:13
  • ...the immediate issue is that `[[` needs to be its own word to be recognized by the parser. That means it needs to have spaces around it. – Charles Duffy Apr 17 '22 at 19:14
  • (also, you should have a `;` or newline before `read` -- right now it's just an argument to `echo`) – Charles Duffy Apr 17 '22 at 19:15
  • ...btw, as a note for the future: Use a line with three backticks and no other content to start or end a code-formatted section. In addition to not messing with your formatting, that also enables syntax highlighting. – Charles Duffy Apr 17 '22 at 19:15
  • To be clear about why you got _this specific_ error: `if[[` is not `if`, and if there's no `if` recognized, then it's invalid for bash to see a `then`. – Charles Duffy Apr 17 '22 at 19:17

0 Answers0