Source files in a bash script.

I am using two versions of ROS next to each other. To use one I have to source some enviroment 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;

Answers


Execute Shell Script Using . ./ (dot space dot slash)

While executing the shell script using “dot space dot slash”, as shown below, it will execute the script in the current shell without forking a sub shell.

$ . ./setup.bash

In other words, this executes the commands specified in the setup.bash in the current shell, and prepares the environment for you.


Need Your Help

Maven: If sentense in pom.xml in the property tag

xml maven if-statement pom.xml sentence

I'd like to set a property if an environment variable is set. I googled a lot on it and all I found is something similar to the code below, but I keep getting the error:

How to access a protected json array in php

php arrays json facebook

I am using the facebook sdk for php. And it is returning a protected json array which I cannot use. Can There Be Another Way of using the protected array.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.