I thought this was a neat idea, but seemed possibly more complex than I wanted it to be. The fundamental problem being that roscd is responsible for tracking a parallel set of state to your own path. My idea was to instead determine, based on your path, if it is a location that ROS knows about. It does not yet handle paths inside of packages, but I'm confident that with a little work, a more clever invocation of sed will do the trick. Also, since I know everyone has slightly different prompt preferences, this version actually augments your current prompt to instead use "ROS:pkgname" wherever the prompt previously used \w. Enjoy! --Jeremy export OLD_PS1=$PS1 export PROMPT_COMMAND=' export PS1=${OLD_PS1} unset ROS_NAME PROMPT_PATH=${PWD} ROS_NAME=`rospack list | sed -nre "s|(.*) ${PWD}\$|\1|p"` [ -n "${ROS_NAME}" ] && { export PS1=`echo $PS1 | sed -e "s|\\\\\w| ROS:${ROS_NAME}|g"` export PS1="${PS1} " } ' 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 > >