I made two modifications to setup.sh to get it working:
Under "Invoke Python script to generate necessary exports of environment variables" change
CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" $@ > $_SETUP_TMP
to
CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" $@ >> $_SETUP_TMP
Under "source all environment hooks" change the termination condition of the while block from
while [ $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT ]; do
to
while [[ $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT ]]; do
The errors should disappear.
References: