#!/bin/bash
instruction=$1
if [ $instruction=="small_square" ]; then
rosrun linux_exam small_square.py
elif [ $instruction=="medium_square" ]; then
rosrun linux_exam medium_square.py
elif [ $instruction=="big_square" ]; then
rosrun linux_exam big_square.py
fi
It passes the small_square test but fails the medium_square and big_square tests. I doubt there is any issue with my code since when I tested it myself it indeed was crossing distances correctly (0.5 for small, 1 for medium and 2 for big). Thanks for the great courses!
It is interesting that @ralves’ solution solved the issue. I double-checked, and it really worked!
However, @sisaha’s original solution was almost right: you should use spaces before and after the ==. So, this should also work:
#!/bin/bash
instruction=$1
if [ $instruction == "small_square" ]; then
do_something;
else
do_something_else;
fi