&&
is not allowed inside the brackets of a test
command, so the missing ]
is the one that bash
believes should be between tmp
and &&
.
A correct form of your command would be
mkdir tmp && cd temp || echo "error"
If mkdir
fails, (or cd
fails after mkdir
succeeds), then execute the echo
. No test
/[
command is needed.