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

Not a Valid Identifier

asked 2016-09-21 12:17:58 -0500

csal gravatar image

updated 2016-09-21 14:14:07 -0500

gvdhoorn gravatar image

I am following the tutorial found on the book Learning ROS by Martinez page 40. When creating a new workspace, after adding a folder and trying to add this path to ROS_PACKAGE_PATH I keep getting the following:

bash: export: `ROS_PACKAGE_PATH~/dev/rosbook:/opt/ros/kinetic/share:/opt/ros/kinetic/stacks': not a valid identifier

These are the commands:

clare@clare-VirtualBox:~$ echo "export ROS_PACKAGE_PATH"~/dev/rosbook:${ROS_PACKAGE_PATH} >> ~/.bashrc
clare@clare-VirtualBox:~$ . ~/.bashrc
edit retag flag offensive close merge delete


that line you're trying to run, is from the book Aaron wrote right? I got the same problem. looks like the book is pretty old and not gonna work for me.

MuratAhmetGenc gravatar image MuratAhmetGenc  ( 2016-09-25 18:21:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-21 14:17:08 -0500

gvdhoorn gravatar image

updated 2016-09-21 14:21:05 -0500

First: don't do what you are trying to do. It is unnecessary to manually edit the ROS_PACKAGE_PATH. It will automatically be updated to include the proper paths whenever you source your target workspace (which in your case I'm guessing is located at ~/dev/rosbook.

After building your workspace, do a source ~/dev/rosbook/devel/setup.bash. That will setup the correct paths.

Second: if you really want to do this, notice that you are missing a = (equals) between ROS_PACKAGE_PATH and ~/dev/rosbook. That most likely leads bash to interpret the entire line as the name of the environment variable that you are trying to set. It then notices that that name includes some illegal characters (ie: characters that cannot be part of an environment variable's name), and thus it prints that error message.

To fix it: open your .bashrc, locate the line that starts with export ROS_PACKAGE_PATH and insert the =. Save, resource.

But note that I don't recommend manually changing ROS_PACKAGE_PATH.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-09-21 12:17:58 -0500

Seen: 2,317 times

Last updated: Sep 25 '16