# "bash: \[: =: unary operator expected" on Linux for Robotics course

**URL:** <https://get-help.theconstruct.ai/t/bash-unary-operator-expected-on-linux-for-robotics-course/3257>\
**Category:** Linux Basics For Robotics\
**Created:** [April 24, 2020, 1:45am UTC](https://get-help.theconstruct.ai/t/bash-unary-operator-expected-on-linux-for-robotics-course/3257 "2020-04-24T01:45:37Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ziga.rupret](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/ziga.rupret/32/6280_2.png) [@ziga.rupret](https://get-help.theconstruct.ai/u/ziga.rupret)\
**Post date:** [December 15, 2020, 7:31am UTC](https://get-help.theconstruct.ai/t/bash-unary-operator-expected-on-linux-for-robotics-course/3257/7 "2020-12-15T07:31:54Z")

</div>

Hi  
i am having the same problem using the copy paste of the code from the course:  
#!/bin/bash

```
ARG1=$1

if [$ARG1 == 'forward']; then
    rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: -0.1
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0"

elif [$ARG1 == 'rotate']; then
    rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.2"

elif [$ARG1 == 'stop']; then
    rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0"
fi

```

i get the folowing:  
./demo.sh: line 5: [: ==: unary operator expected  
./demo.sh: line 15: [: ==: unary operator expected  
./demo.sh: line 25: [: ==: unary operator expected

i was having the same isue in the exam took me a while to trial and error what was wrong i think it has something to do with spaces? but since it is in a course a copy paste should work?

---

_[View the full topic](https://get-help.theconstruct.ai/t/bash-unary-operator-expected-on-linux-for-robotics-course/3257)._
