LMSouq
general-dev Open

Source files in a bash script

US
user408041
1 month ago
3 views
Problem Description
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

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base