Wrote a shell script:
#!/bin/bash
source Tools/simulation/gazebo-classic/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/simulation/gazebo-classic/sitl_gazebo-classic
The first line is source and the second line is export.
Running export
the two lines found has no effect.
The reason is that my running method is ./my_setup.sh
, and the running result is effective in the sub-shell, not the parent shell.
Reference article: Linux shell script export is invalid , just modify it source ./my_setup.bash
.