title: source .bashrc in a script not working
body: <p>I am doing a script that is installing ros and after installing it, compiling a workspace with catkin_make.</p>
  
  <p>I found the solution to solve my problem but I can't explain the reason. I have a file called install.bash that is calling others:</p>
  
  <pre><code>#!/bin/bash
  
  source 01_install_ros.bash
  </code></pre>
  
  <p>What is important is in <code>01_install_ros.bash</code>:</p>
  
  <pre><code># variable not set because it is done in the script setup.bash of ros
  echo "before source in 01_install_ros"
  echo "ROS_ROOT: "$ROS_ROOT
  whereis catkin_make
  echo ""
  
  echo "source /opt/ros/kinetic/setup.bash" &gt;&gt; $HOME/.bashrc
  # doesn't set the variables
  source "$HOME"/.bashrc
  # the solutions
  source /opt/ros/kinetic/setup.bash
  
  # variables not set if I use the source of .bashrc
  echo "after source in 01_install_ros"
  echo "ROS_ROOT: "$ROS_ROOT
  whereis catkin_make
  echo ""
  </code></pre>
  
  <p>As written in comments, sourcing .bashrc instead of directly setup.bash doesn't work. I really don't get why. Can you explain me?</p>