I am using two versions of ROS next to each other. To use one I have to source some environment variables for the specific version. I would like to create a script that does this.
But if I create a script like below the variables are not set, they are probably set in a subshell. How can I source the files to the main terminal shell?
source.sh:
source /opt/ros/fuerte/setup.bash;
source ~/fuerte_workspace/setup.bash;
Here is how i am calling source.sh:
./source.sh
# This does not echo anything, but I expect it should
echo $ros_config
Update: By sourcing source.sh as suggested in the answer, I can now see the variables being set.
source ./source.sh
# This works now
echo $ros_config
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…