Source files in a bash script

后端 未结 2 661
情歌与酒
情歌与酒 2020-12-02 09:42

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

相关标签:
2条回答
  • 2020-12-02 10:28

    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.

    0 讨论(0)
  • 2020-12-02 10:31

    Use dot notation to source in the script file in the current shell i.e. without creating a sub-shell:

    . /opt/ros/fuerte/setup.bash
    . ~/fuerte_workspace/setup.bash
    
    0 讨论(0)
提交回复
热议问题