Not bad! :) The problem is... I bet most folks tend to mix-and-match roscd with cd. [:/opt/ros/unstable/ros]$ cd /tmp/ [:/tmp]$ roscd pcl [pcl]:$ cd / []:$ ls ... hangs... Cltr+C... nothing Cheers, Radu. -- http://pointclouds.org On 02/02/2011 10:51 AM, Patrick Bouffard wrote: > +1. Nice. > > Can this be put into diamondback (as a disabled-by-default option)? > > Pat > > On Wed, Feb 2, 2011 at 10:29 AM, Ivan Dryanovski > wrote: >> Hi everyone, >> >> My bash shell prompt and tab title normally look something like this: >> >> "idryanov@idryanov-desktop:~/ros/some-stack/foo$" >> >> I like to have several tabs opened, each one for a different package >> I'm working on. I tweaked my rosbash file to manipulate the bash >> prompt i get when working in ROS. So every time I type in `roscd foo` >> (where foo is some package or stack) the tab title is replaced by >> "[foo]" and my prompt is replaced by "[foo]:$ ". Further, if I then >> type in `cd src`, the prompt is replaced by "[foo\src]". This makes it >> much quicker to identify the working directory for each of the >> (possibly many) tabs I have open. >> >> When I type in `roscd`, the tab title and prompt revert to their >> default system behavior (whatever it was prior to typing in `roscd >> foo`). >> >> To play around with this, just replace the "function roscd" in >> /ros/tools/rosbash with the code at the end of the email. >> >> Cheers, >> Ivan >> >> ########################################### >> # To enter ROSCD_MODE, type in roscd name_of_package >> # To exit ROSCD_MODE, type in roscd >> # If ROSCD_MODE is set, replaces the default bash prompt and tab title >> # with [name_of_package]. >> >> export PS1_BAK=$PS1 >> >> PROMPT_COMMAND=' >> if [ "$ROSCD_MODE" ]; then >> basedir="${PWD#${PWD%${ROSCD_MODE}*}}" >> export PS1="\[\e]0;[ ${ROSCD_MODE} ]\a\]\[\e[31;1m\][$basedir]:\$ \[\e[0m\]" >> else >> export PS1=$PS1_BAK >> fi' >> >> function roscd { >> local rosvals >> >> if [ -z $1 ]; then >> cd ${ROS_ROOT} >> unset ROSCD_MODE >> return 0 >> fi >> >> _ros_decode_path $1 forceeval >> if [ $? != 0 ]; then >> echo "roscd: No such package '$1'" >> return 1 >> elif [ -z $rosvals ]; then >> cd ${ROS_ROOT} >> return 0 >> else >> cd ${rosvals[1]}${rosvals[2]}${rosvals[3]} >> export ROSCD_MODE=${rosvals[0]} >> return 0 >> fi >> } >> >> _______________________________________________ >> ros-users mailing list >> ros-users@code.ros.org >> https://code.ros.org/mailman/listinfo/ros-users >> >> > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users