2
rated 0 times
[
2]
[
0]
/ answers: 1 / hits: 2640
/ 2 Years ago, fri, march 18, 2022, 7:04:16
I'd like the title of my terminal windows to show the last command that ran. It'd be handy for finding the terminal that's running Mongrel in Dev/Test/Prod etc (for testing rails apps).
I tried this code:
if [ "$SHELL" = '/bin/bash' ]
then
case $TERM in
rxvt|*term)
set -o functrace
trap 'echo -ne "e]0;$BASH_COMMAND007"' DEBUG
# export PS1="e]0;$TERM007$PS1"
;;
esac
fi
At least, I think that's the code that I tried. It did work, but it caused some strange behavior, like window titles that would get stuck in a loop until I hit Ctrl C when changing directory to a symlink.
What's a reliable way to set my window title to the last command that was run?
More From » bash