[ros-users] [Ros-developers] suggest new ros shebang command

Thibault Kruse kruset at in.tum.de
Tue Aug 9 21:40:51 UTC 2011


I would like to make a suggestion.

I want to add a command (called ros-shebang for now) to ros/bin that runs
script files by invoking a second shebang line.

This allows invoking script interpreters with #! and passing additional
arguments, as well as invoking interpreters that live in ROS packages.

My stake is calling an interpreter for roslisp scripting. However a
similar concern is invoking of rosh plugins, see

Example for rosh:
#! /usr/bin/env ros-shebang
#! /usr/bin/env rosrun rosh rosh rosh/echolet.py

Example for roslisp:

#! /usr/bin/env ros-shebang
;; /usr/bin/env rosrun sbcl run-sbcl.sh --script

One less known alternative is to use other directives to declare the
script interpreter than #!, (in case you wonder, for lisp, #| and ":";
work) however this does not work with python subprocess.Popen, which means
roslaunch and rostest would fail to run scripts like that (except using
shell=True, but this is strongly discouraged for security and portability

- A modification to roslaunch syntax to allow forcing shell=true

- an executable in ros/bin that executes roslisp scripts, such that we
could write:
#! /usr/bin/env ros-run-roslisp-script

- A required fixed installation of our lisp implementation, or some custom
made variant of /usr/bin/env

I wrote a ros-shebang script in python that works, which is no more magic
than reading the second line and calling python execvp on it (minus the
first two symbols).

If a new command were introduced to ros/bin, this would affect more people
than those working with roslisp, so opinions should be heard. There is no
urgency to this, roslisp works fine as it is without offering comfortable
scripting, just as rosh works fine by loading plugins after the shebang

Not sure if there are other scripting interpreter usages with similar
issues in ROS (Java, Lua, Javascript, ...).



ros-developers mailing list
ros-developers at code.ros.org

More information about the ros-users mailing list