SOLUTION: There was a bug in the program. Instructions below with sleep helped me find it.
Does anyone know how to do this?
I tried the following, but the backslash escape before a space did not work as expected with xterm or Apple Terminal:
SEARCH=' ' REPLACE='_' # XXX fix display of spaces PWD_SPACE="${PWD//$SEARCH/$REPLACE}" Full context:
# replace spaces with percent sign for pathnames # with spaces SEARCH=' ' REPLACE='%20' PWD_URL="${PWD//$SEARCH/$REPLACE}" SEARCH=' ' REPLACE='_' # XXX fix display of spaces PWD_SPACE="${PWD//$SEARCH/$REPLACE}" if [ -n "$KSH_VERSION" ]; then TMP_PWD=$(shortpath $PWD_SPACE) else TMP_PWD=$(shortpath_bash_trunc $PWD_SPACE) fi if [ -t 0 ]; then if [ "$TERM_PROGRAM" == "Apple_Terminal" ]; then #titlebar "${SYS} : ${PWD##*/}" $ECHOE "\033]0;\007" $ECHOE "\033]6;\007" $ECHOE "\033]7;file:$PWD_URL\007" elif [[ "$TERM" == *"xterm"* ]]; then $ECHOE "\033]0;$TMP_PWD\007" $ECHOE "\033]6;\007" $ECHOE "\033]7;\007" fi fi
printf '\033]0;%s\007' "$PWD"' ; sleep 30- at least for 30 seconds?