ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

roscd returns "bash: reldir: unbound variable"

asked 2012-03-19 05:09:13 -0600

ultinate gravatar image

updated 2012-03-19 06:19:31 -0600

Hi everyone,

When going through the tutorial, I get errors with certain ROS (navigation) functions:

$ roscd roscpp
bash: reldir: unbound variable
$ rosls roscpp_tutorials
bash: reldir: unbound variable
$ rosed roscpp
bash: 2: unbound variable

Any ideas how to resolve this?


System: Ubuntu 11.10
Bash: GNU bash, version 4.2.10(1)-release (i686-pc-linux-gnu)
Affected tutorial step:
I tried so far: Reinstalling ROS (using apt-get).
What works: rosnode, roscore, rospack, ... (most methods)
What doesn't work: roscd, rosls, rosed

Note: During first config as described in the tutorial, I got the following errors:

$ source /opt/ros/electric/setup.bash
bash: PYTHONPATH: unbound variable
bash: ROS_MASTER_URI: unbound variable

I resolved this by manually defining these variables in ~/.bashrc:

$ export PYTHONPATH=$ROS_ROOT/core/roslib/src
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-03-21 01:53:04 -0600

ultinate gravatar image

Thanks dornhege,

my .bashrc didn't contain set -u, but it contained set -o nounset instead.

After uncommenting that, all problems mentioned above disappear. I did not change any ROS scripts. Does this mean that ROS scripts are not programmed robustly enough?

In any case, ticket closed.

edit flag offensive delete link more


-u is short for -o nounset. About the script: I'm not sure, maybe it only works like this in bash. Otherwise it would be worth ticketing.

dornhege gravatar image dornhege  ( 2012-03-21 02:50:10 -0600 )edit

answered 2012-03-19 05:24:38 -0600

dornhege gravatar image

You .bashrc probably contains set -u.

The proper fix would be to change the line in /opt/ros/electric/

export PYTHONPATH=${ROS_ROOT}/core/roslib/src:${PYTHONPATH}


export PYTHONPATH=${ROS_ROOT}/core/roslib/src:${PYTHONPATH-}

I would say that this is the intended behaviour.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-03-19 05:09:13 -0600

Seen: 2,076 times

Last updated: Mar 21 '12