]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: export ROS_DISTRO
authorSamir Benmendil <samir.benmendil@gmail.com>
Fri, 20 Feb 2015 18:52:25 +0000 (18:52 +0000)
committerSamir Benmendil <samir.benmendil@gmail.com>
Fri, 20 Feb 2015 18:52:25 +0000 (18:52 +0000)
zsh/functions/rosinit

index ac985a8235b4929fb60af676eb53fe877a263425..082f156084ef32a0f01c3c6c16cb48e478982340 100644 (file)
@@ -5,13 +5,14 @@ function rosinit() {
     local -a ROS_DISTROS
     ROS_DISTROS=("hydro" "indigo")
 
-    local ROS_DISTRO=$1
-    if [[ -z "$ROS_DISTRO" ]]; then
+    local distro=$1
+    if [[ -z "$distro" ]]; then
         for d in "${ROS_DISTROS[@]}"; do
-            [[ -f "/opt/ros/$d/setup.zsh" ]] && ROS_DISTRO=$d
+            [[ -f "/opt/ros/$d/setup.zsh" ]] && distro=$d
         done
     fi
-    if [[ -f "/opt/ros/$ROS_DISTRO/setup.zsh" ]]; then
+    if [[ -f "/opt/ros/$distro/setup.zsh" ]]; then
+        export ROS_DISTRO=$distro
         export ROS_OS_OVERRIDE=arch
         source /opt/ros/$ROS_DISTRO/setup.zsh
         source $WORKSPACE/devel/setup.zsh
@@ -21,6 +22,6 @@ function rosinit() {
         # export ROS_TEST_RESULTS_DIR=$HOME/.ros
         roscd
     else
-        echo "ROS $ROS_DISTRO doesn't seem to be installed." >&2
+        echo "ROS $distro doesn't seem to be installed." >&2
     fi
 }